-----Original Message----- From: Knut Anders Hatlen [mailto:[email protected]] Sent: Monday, September 12, 2011 8:32 PM To: [email protected] Subject: [?? Probable Spam] Re: A potential bug report
Yiqing Zhu <[email protected]> writes: > Hi, > > Currently I’m doing some programming analysis work on derby. > > And I found that in the function ”EmbedResultSet.close()”, we should > add the follow snippet after the statement “currentRow =null”. In > order to make the function complete. > > Snippet: > > if (columnGotUpdated != null && currentRowHasBeenUpdated) { > > initializeUpdateRowModifiers(); > > } > > > Am I right? Wish you reply, thank you very much! Hi Yiqing, Thanks for reporting this potential problem. Could you please elaborate on why you think the extra code is needed in EmbedResultSet.close()? After close() has been called, most methods of EmbedResultSet will throw an SQLException if they are called. So it might be OK that some state variables are not reset by close, as they will not be used again. -- Knut Anders Hi, Thank you very much for your reply. I find one program semantic rule in this class is "each time when 'currentRow' is set to null, 'currentRowHasBeenUpdated' should be set to false, which is done by calling initializeUpdateRowModifiers(). And this rule is proved by the comments in this class. I think your point of view is right. After the "close()" is called, the "isClosed" field will be set to true, so if other methods in this class are called and check this value, it will throw SQLException. However, because I don’t have a complete idea of derby, I'm not sure whether there exists some method missing checking the "isClosed" field, so I think this inconsistent state may cause some potential problem. Therefore, if the snippet "if (columnGotUpdated != null && currentRowHasBeenUpdated) initializeUpdateRowModifiers();"is added to the method after "currentRow = null", the function will be more complete, meanwhile, it won't affect the efficiency of derby and cause other problems. Thank you again! Sincerely, yiqing
