diff --git a/base/src/org/compiere/model/CalloutInvoiceBatch.java b/base/src/org/compiere/model/CalloutInvoiceBatch.java index aeb674050b..9cf04a4180 100644 --- a/base/src/org/compiere/model/CalloutInvoiceBatch.java +++ b/base/src/org/compiere/model/CalloutInvoiceBatch.java @@ -85,11 +85,13 @@ public class CalloutInvoiceBatch extends CalloutEngine + "WHERE p.C_BPartner_ID=? AND p.IsActive='Y'"; // #1 boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); + 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()) { @@ -150,14 +152,16 @@ public class CalloutInvoiceBatch extends CalloutEngine } } } - rs.close(); - pstmt.close(); } catch (SQLException e) { log.log(Level.SEVERE, sql, e); return e.getLocalizedMessage(); } + finally + { + DB.close(rs, pstmt); + } // setDocumentNo(ctx, WindowNo, mTab); return tax (ctx, WindowNo, mTab, mField, value);