diff --git a/base/src/org/compiere/process/BPartnerValidate.java b/base/src/org/compiere/process/BPartnerValidate.java index eaba4ae1d9..45a83b23ba 100644 --- a/base/src/org/compiere/process/BPartnerValidate.java +++ b/base/src/org/compiere/process/BPartnerValidate.java @@ -16,11 +16,17 @@ *****************************************************************************/ package org.compiere.process; -import java.math.*; -import java.sql.*; -import java.util.logging.*; -import org.compiere.model.*; -import org.compiere.util.*; +import java.math.BigDecimal; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.logging.Level; + +import org.compiere.model.MBPartner; +import org.compiere.model.MInvoice; +import org.compiere.model.MPayment; +import org.compiere.util.AdempiereUserError; +import org.compiere.util.DB; +import org.compiere.util.Msg; /** @@ -79,33 +85,26 @@ public class BPartnerValidate extends SvrProcess { String sql = "SELECT * FROM C_BPartner WHERE C_BP_Group_ID=? AND IsActive='Y'"; PreparedStatement pstmt = null; + ResultSet rs = null; try { pstmt = DB.prepareStatement (sql, get_TrxName()); pstmt.setInt (1, p_C_BP_Group_ID); - ResultSet rs = pstmt.executeQuery (); + rs = pstmt.executeQuery (); while (rs.next ()) { MBPartner bp = new MBPartner (getCtx(), rs, get_TrxName()); checkBP (bp); } - rs.close (); - pstmt.close (); - pstmt = null; } catch (Exception e) { log.log(Level.SEVERE, sql, e); } - try + finally { - if (pstmt != null) - pstmt.close (); - pstmt = null; - } - catch (Exception e) - { - pstmt = null; + DB.close(rs, pstmt); + rs = null; pstmt = null; } } //