BF [ 1874419 ] JDBC Statement not close in a finally block - fixed for MChangeLog

This commit is contained in:
teo_sarca 2008-02-04 21:09:33 +00:00
parent 8805fceef2
commit 751ef01796
1 changed files with 5 additions and 12 deletions

View File

@ -57,29 +57,22 @@ public class MChangeLog extends X_AD_ChangeLog
+ "WHERE t.AD_Table_ID=c.AD_Table_ID AND c.ColumnName='EntityType') " + "WHERE t.AD_Table_ID=c.AD_Table_ID AND c.ColumnName='EntityType') "
+ "ORDER BY t.AD_Table_ID"; + "ORDER BY t.AD_Table_ID";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null;
try try
{ {
pstmt = DB.prepareStatement(sql, null); pstmt = DB.prepareStatement(sql, null);
ResultSet rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) while (rs.next())
list.add(new Integer(rs.getInt(1))); list.add(new Integer(rs.getInt(1)));
rs.close();
pstmt.close();
pstmt = null;
} }
catch (Exception e) catch (Exception e)
{ {
s_log.log(Level.SEVERE, sql, e); s_log.log(Level.SEVERE, sql, e);
} }
try finally
{ {
if (pstmt != null) DB.close(rs, pstmt);
pstmt.close(); rs = null; pstmt = null;
pstmt = null;
}
catch (Exception e)
{
pstmt = null;
} }
// Convert to Array // Convert to Array
s_changeLog = new int [list.size()]; s_changeLog = new int [list.size()];