From 84e38e45a17e74bf98d836079580677703d4c0c2 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Thu, 14 Feb 2008 22:32:05 +0000 Subject: [PATCH] BF [ 1874419 ] JDBC Statement not close in a finally block --- base/src/org/compiere/model/CalloutGLJournal.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/base/src/org/compiere/model/CalloutGLJournal.java b/base/src/org/compiere/model/CalloutGLJournal.java index cca0225b72..e5d0ef9e9a 100644 --- a/base/src/org/compiere/model/CalloutGLJournal.java +++ b/base/src/org/compiere/model/CalloutGLJournal.java @@ -75,12 +75,14 @@ public class CalloutGLJournal extends CalloutEngine // globalqss - cruiz - Bug [ 1577712 ] Financial Period Bug + " AND IsActive='Y'" + " AND PeriodType='S'"; + PreparedStatement pstmt = null; + ResultSet rs = null; try { - PreparedStatement pstmt = DB.prepareStatement(sql, null); + pstmt = DB.prepareStatement(sql, null); pstmt.setInt(1, AD_Client_ID); pstmt.setTimestamp(2, DateAcct); - ResultSet rs = pstmt.executeQuery(); + rs = pstmt.executeQuery(); if (rs.next()) C_Period_ID = rs.getInt(1); rs.close(); @@ -92,6 +94,10 @@ public class CalloutGLJournal extends CalloutEngine log.log(Level.SEVERE, sql, e); return e.getLocalizedMessage(); } + finally + { + DB.close(rs, pstmt); + } if (C_Period_ID != 0) mTab.setValue("C_Period_ID", new Integer(C_Period_ID)); }