diff --git a/base/src/org/compiere/model/CalloutInOut.java b/base/src/org/compiere/model/CalloutInOut.java index 5fef0f21bd..f410ee09b8 100644 --- a/base/src/org/compiere/model/CalloutInOut.java +++ b/base/src/org/compiere/model/CalloutInOut.java @@ -198,11 +198,13 @@ public class CalloutInOut extends CalloutEngine + " AND p.C_BPartner_ID=c.C_BPartner_ID(+)" + " AND p.C_BPartner_ID=?"; // 1 + PreparedStatement pstmt = null; + ResultSet rs = null; try { - PreparedStatement pstmt = DB.prepareStatement(sql, null); + pstmt = DB.prepareStatement(sql, null); pstmt.setInt(1, C_BPartner_ID.intValue()); - ResultSet rs = pstmt.executeQuery(); + rs = pstmt.executeQuery(); if (rs.next()) { //[ 1867464 ] @@ -234,14 +236,16 @@ public class CalloutInOut extends CalloutEngine false); }// } - rs.close(); - pstmt.close(); } catch (SQLException e) { log.log(Level.SEVERE, sql, e); return e.getLocalizedMessage(); } + finally + { + DB.close(rs, pstmt); + } return ""; } // 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') " + "WHERE w.M_Warehouse_ID=?"; // 1 + PreparedStatement pstmt = null; + ResultSet rs = null; try { - PreparedStatement pstmt = DB.prepareStatement(sql, null); + pstmt = DB.prepareStatement(sql, null); pstmt.setInt(1, M_Warehouse_ID.intValue()); - ResultSet rs = pstmt.executeQuery(); + rs = pstmt.executeQuery(); if (rs.next()) { // Org @@ -291,14 +297,16 @@ public class CalloutInOut extends CalloutEngine Env.setContext(ctx, WindowNo, "M_Locator_ID", ii.intValue()); } } - rs.close(); - pstmt.close(); } catch (SQLException e) { log.log(Level.SEVERE, sql, e); return e.getLocalizedMessage(); } + finally + { + DB.close(rs, pstmt); + } return ""; } // warehouse