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

This commit is contained in:
Heng Sin Low 2008-02-14 22:34:09 +00:00
parent 84e38e45a1
commit aa73374af2
1 changed files with 8 additions and 4 deletions

View File

@ -85,11 +85,13 @@ public class CalloutInvoiceBatch extends CalloutEngine
+ "WHERE p.C_BPartner_ID=? AND p.IsActive='Y'"; // #1 + "WHERE p.C_BPartner_ID=? AND p.IsActive='Y'"; // #1
boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
PreparedStatement pstmt = null;
ResultSet rs = null;
try try
{ {
PreparedStatement pstmt = DB.prepareStatement(sql, null); pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, C_BPartner_ID.intValue()); pstmt.setInt(1, C_BPartner_ID.intValue());
ResultSet rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
// //
if (rs.next()) if (rs.next())
{ {
@ -150,14 +152,16 @@ public class CalloutInvoiceBatch extends CalloutEngine
} }
} }
} }
rs.close();
pstmt.close();
} }
catch (SQLException e) catch (SQLException e)
{ {
log.log(Level.SEVERE, sql, e); log.log(Level.SEVERE, sql, e);
return e.getLocalizedMessage(); return e.getLocalizedMessage();
} }
finally
{
DB.close(rs, pstmt);
}
// //
setDocumentNo(ctx, WindowNo, mTab); setDocumentNo(ctx, WindowNo, mTab);
return tax (ctx, WindowNo, mTab, mField, value); return tax (ctx, WindowNo, mTab, mField, value);