From 16697248fb7e3daf43680dc11d9c191cd96c6d98 Mon Sep 17 00:00:00 2001 From: "Redhuan D. Oon" Date: Tue, 19 Feb 2008 06:29:01 +0000 Subject: [PATCH] *BF [ 1874419 ] JDBC Statement not close in a finally block --- base/src/org/compiere/util/WebUser.java | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/base/src/org/compiere/util/WebUser.java b/base/src/org/compiere/util/WebUser.java index 2cc4db2137..507343a9f0 100644 --- a/base/src/org/compiere/util/WebUser.java +++ b/base/src/org/compiere/util/WebUser.java @@ -283,20 +283,18 @@ public class WebUser + " AND AD_User_ID=?"; PreparedStatement pstmt = null; + ResultSet rs = null; try { pstmt = DB.prepareStatement(sql, null); pstmt.setInt(1, m_AD_Client_ID); pstmt.setInt(2, AD_User_ID); - ResultSet rs = pstmt.executeQuery(); + rs = pstmt.executeQuery(); if (rs.next()) { m_bpc = new MUser (m_ctx, rs, null); log.fine("= found BPC=" + m_bpc); } - rs.close(); - pstmt.close(); - pstmt = null; } catch (Exception e) { @@ -304,14 +302,8 @@ public class WebUser } finally { - try - { - if (pstmt != null) - pstmt.close (); - } - catch (Exception e) - {} - pstmt = null; + DB.close(rs, pstmt); + rs = null; pstmt = null; } // Password not entered