*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;
AttributesImpl atts = new AttributesImpl();
PreparedStatement pstmt = null;
ResultSet rs = null;
pstmt = DB.prepareStatement (sql, getTrxName(ctx));
try {
ResultSet rs = pstmt.executeQuery();
rs = pstmt.executeQuery();
while (rs.next())
{
@ -104,21 +105,15 @@ public class DynValRuleElementHandler extends AbstractElementHandler {
document.startElement("","","dynvalrule",atts);
document.endElement("","","dynvalrule");
}
rs.close();
pstmt.close();
pstmt = null;
}
}
catch (Exception e){
log.log(Level.SEVERE,"getProcess", e);
}
finally{
try {
if (pstmt != null)
pstmt.close ();
}
catch (Exception e){}
pstmt = null;
finally
{
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
}