From dcc794fddc8ad4934d68dd0bd21378ad9de17a57 Mon Sep 17 00:00:00 2001 From: "Redhuan D. Oon" Date: Tue, 19 Feb 2008 06:26:45 +0000 Subject: [PATCH] *BF [ 1874419 ] JDBC Statement not close in a finally block --- base/src/org/compiere/util/WebInfo.java | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/base/src/org/compiere/util/WebInfo.java b/base/src/org/compiere/util/WebInfo.java index 80b21d690c..7d4fd4fb15 100644 --- a/base/src/org/compiere/util/WebInfo.java +++ b/base/src/org/compiere/util/WebInfo.java @@ -432,33 +432,25 @@ public class WebInfo + " AND (C_BPartner_ID=?" + " OR SalesRep_ID IN (SELECT AD_User_ID FROM AD_User WHERE C_BPartner_ID=?))"; PreparedStatement pstmt = null; + ResultSet rs = null; try { pstmt = DB.prepareStatement(sql, null); pstmt.setInt(1, m_id); pstmt.setInt(2, getC_BPartner_ID()); pstmt.setInt(3, getC_BPartner_ID()); - ResultSet rs = pstmt.executeQuery(); + rs = pstmt.executeQuery(); if (rs.next()) retValue = new MRequest (m_ctx, rs, null); - rs.close(); - pstmt.close(); - pstmt = null; - } + } catch (Exception e) { log.log(Level.SEVERE, "R_Request_ID=" + m_id, e); } finally { - try - { - if (pstmt != null) - pstmt.close (); - } - catch (Exception e) - {} - pstmt = null; + DB.close(rs, pstmt); + rs = null; pstmt = null; } log.fine("R_Request_ID=" + m_id + " - " + retValue); return retValue;