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

This commit is contained in:
Heng Sin Low 2008-02-14 22:28:38 +00:00
parent 4b7aa69c0b
commit 7821230d9c
1 changed files with 16 additions and 8 deletions

View File

@ -198,11 +198,13 @@ public class CalloutInOut extends CalloutEngine
+ " AND p.C_BPartner_ID=c.C_BPartner_ID(+)" + " AND p.C_BPartner_ID=c.C_BPartner_ID(+)"
+ " AND p.C_BPartner_ID=?"; // 1 + " AND p.C_BPartner_ID=?"; // 1
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())
{ {
//[ 1867464 ] //[ 1867464 ]
@ -234,14 +236,16 @@ public class CalloutInOut extends CalloutEngine
false); false);
}// }//
} }
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);
}
return ""; return "";
} // bpartner } // bpartner
@ -269,11 +273,13 @@ public class CalloutInOut extends CalloutEngine
+ " LEFT OUTER JOIN M_Locator l ON (l.M_Warehouse_ID=w.M_Warehouse_ID AND l.IsDefault='Y') " + " LEFT OUTER JOIN M_Locator l ON (l.M_Warehouse_ID=w.M_Warehouse_ID AND l.IsDefault='Y') "
+ "WHERE w.M_Warehouse_ID=?"; // 1 + "WHERE w.M_Warehouse_ID=?"; // 1
PreparedStatement pstmt = null;
ResultSet rs = null;
try try
{ {
PreparedStatement pstmt = DB.prepareStatement(sql, null); pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, M_Warehouse_ID.intValue()); pstmt.setInt(1, M_Warehouse_ID.intValue());
ResultSet rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
// Org // Org
@ -291,14 +297,16 @@ public class CalloutInOut extends CalloutEngine
Env.setContext(ctx, WindowNo, "M_Locator_ID", ii.intValue()); Env.setContext(ctx, WindowNo, "M_Locator_ID", ii.intValue());
} }
} }
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);
}
return ""; return "";
} // warehouse } // warehouse