BF [ 1874419 ] JDBC Statement not close in a finally block

This commit is contained in:
Heng Sin Low 2008-02-14 22:32:05 +00:00
parent 47ce11e65d
commit 84e38e45a1
1 changed files with 8 additions and 2 deletions

View File

@ -75,12 +75,14 @@ public class CalloutGLJournal extends CalloutEngine
// globalqss - cruiz - Bug [ 1577712 ] Financial Period Bug // globalqss - cruiz - Bug [ 1577712 ] Financial Period Bug
+ " AND IsActive='Y'" + " AND IsActive='Y'"
+ " AND PeriodType='S'"; + " AND PeriodType='S'";
PreparedStatement pstmt = null;
ResultSet rs = null;
try try
{ {
PreparedStatement pstmt = DB.prepareStatement(sql, null); pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, AD_Client_ID); pstmt.setInt(1, AD_Client_ID);
pstmt.setTimestamp(2, DateAcct); pstmt.setTimestamp(2, DateAcct);
ResultSet rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
C_Period_ID = rs.getInt(1); C_Period_ID = rs.getInt(1);
rs.close(); rs.close();
@ -92,6 +94,10 @@ public class CalloutGLJournal extends CalloutEngine
log.log(Level.SEVERE, sql, e); log.log(Level.SEVERE, sql, e);
return e.getLocalizedMessage(); return e.getLocalizedMessage();
} }
finally
{
DB.close(rs, pstmt);
}
if (C_Period_ID != 0) if (C_Period_ID != 0)
mTab.setValue("C_Period_ID", new Integer(C_Period_ID)); mTab.setValue("C_Period_ID", new Integer(C_Period_ID));
} }