From a0884d2c93f27a644ff957ddb972ed6b876235ee Mon Sep 17 00:00:00 2001 From: teo_sarca Date: Mon, 30 Jun 2008 06:53:58 +0000 Subject: [PATCH] org.compiere.acct.DocTax: fix db connection --- base/src/org/compiere/acct/DocTax.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/base/src/org/compiere/acct/DocTax.java b/base/src/org/compiere/acct/DocTax.java index 3a3725f325..24bee13c08 100644 --- a/base/src/org/compiere/acct/DocTax.java +++ b/base/src/org/compiere/acct/DocTax.java @@ -93,21 +93,25 @@ public final class DocTax String sql = "SELECT T_Due_Acct, T_Liability_Acct, T_Credit_Acct, T_Receivables_Acct, T_Expense_Acct " + "FROM C_Tax_Acct WHERE C_Tax_ID=? AND C_AcctSchema_ID=?"; int validCombination_ID = 0; + PreparedStatement pstmt = null; + ResultSet rs = null; try { - PreparedStatement pstmt = DB.prepareStatement(sql, null); + pstmt = DB.prepareStatement(sql, null); pstmt.setInt(1, m_C_Tax_ID); pstmt.setInt(2, as.getC_AcctSchema_ID()); - ResultSet rs = pstmt.executeQuery(); + rs = pstmt.executeQuery(); if (rs.next()) validCombination_ID = rs.getInt(AcctType+1); // 1..5 - rs.close(); - pstmt.close(); } catch (SQLException e) { log.log(Level.SEVERE, sql, e); } + finally { + DB.close(rs, pstmt); + rs = null; pstmt = null; + } if (validCombination_ID == 0) return null; return MAccount.get(as.getCtx(), validCombination_ID);