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

This commit is contained in:
Redhuan D. Oon 2008-02-19 13:29:08 +00:00
parent 0498f82f20
commit f5061798f9
1 changed files with 7 additions and 12 deletions

View File

@ -91,11 +91,12 @@ public class DynValRuleElementHandler extends AbstractElementHandler {
String sql = "SELECT Name FROM AD_Val_Rule WHERE AD_Val_Rule_ID= " + AD_Val_Rule_ID; String sql = "SELECT Name FROM AD_Val_Rule WHERE AD_Val_Rule_ID= " + AD_Val_Rule_ID;
AttributesImpl atts = new AttributesImpl(); AttributesImpl atts = new AttributesImpl();
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null;
pstmt = DB.prepareStatement (sql, getTrxName(ctx)); pstmt = DB.prepareStatement (sql, getTrxName(ctx));
try { try {
ResultSet rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) while (rs.next())
{ {
@ -104,21 +105,15 @@ public class DynValRuleElementHandler extends AbstractElementHandler {
document.startElement("","","dynvalrule",atts); document.startElement("","","dynvalrule",atts);
document.endElement("","","dynvalrule"); document.endElement("","","dynvalrule");
} }
rs.close(); }
pstmt.close();
pstmt = null;
}
catch (Exception e){ catch (Exception e){
log.log(Level.SEVERE,"getProcess", e); log.log(Level.SEVERE,"getProcess", e);
} }
finally{ finally
try { {
if (pstmt != null) DB.close(rs, pstmt);
pstmt.close (); rs = null; pstmt = null;
}
catch (Exception e){}
pstmt = null;
} }
} }