diff --git a/base/src/org/compiere/model/MBPartnerLocation.java b/base/src/org/compiere/model/MBPartnerLocation.java index 5f1e00fe73..b15be615d9 100644 --- a/base/src/org/compiere/model/MBPartnerLocation.java +++ b/base/src/org/compiere/model/MBPartnerLocation.java @@ -41,30 +41,22 @@ public class MBPartnerLocation extends X_C_BPartner_Location ArrayList list = new ArrayList(); String sql = "SELECT * FROM C_BPartner_Location WHERE C_BPartner_ID=?"; PreparedStatement pstmt = null; + ResultSet rs = null; try { pstmt = DB.prepareStatement (sql, null); pstmt.setInt (1, C_BPartner_ID); - ResultSet rs = pstmt.executeQuery (); + rs = pstmt.executeQuery (); while (rs.next ()) list.add(new MBPartnerLocation(ctx, rs, null)); - rs.close (); - pstmt.close (); - pstmt = null; } catch (Exception e) { s_log.log(Level.SEVERE, "getForBPartner", e); } - try + finally { - if (pstmt != null) - pstmt.close (); - pstmt = null; - } - catch (Exception e) - { - pstmt = null; + DB.close(rs, pstmt); } MBPartnerLocation[] retValue = new MBPartnerLocation[list.size ()]; list.toArray (retValue);