*BF [ 1874419 ] JDBC Statement not close in a finally block

organize imports
This commit is contained in:
Redhuan D. Oon 2008-02-19 13:25:57 +00:00
parent 6272c772c0
commit b76998a7a2
1 changed files with 25 additions and 19 deletions

View File

@ -16,12 +16,25 @@
*****************************************************************************/ *****************************************************************************/
package org.compiere.acct; package org.compiere.acct;
import java.math.*; import java.math.BigDecimal;
import java.sql.*; import java.sql.PreparedStatement;
import java.util.*; import java.sql.ResultSet;
import java.util.logging.*; import java.util.ArrayList;
import org.compiere.model.*; import java.util.logging.Level;
import org.compiere.util.*;
import org.compiere.model.MAccount;
import org.compiere.model.MAcctSchema;
import org.compiere.model.MAllocationHdr;
import org.compiere.model.MAllocationLine;
import org.compiere.model.MCashLine;
import org.compiere.model.MConversionRate;
import org.compiere.model.MFactAcct;
import org.compiere.model.MInvoice;
import org.compiere.model.MInvoiceLine;
import org.compiere.model.MPayment;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
/** /**
* Post Allocation Documents. * Post Allocation Documents.
@ -550,11 +563,12 @@ public class Doc_Allocation extends Doc
+ "FROM C_Payment p INNER JOIN C_DocType d ON (p.C_DocType_ID=d.C_DocType_ID) " + "FROM C_Payment p INNER JOIN C_DocType d ON (p.C_DocType_ID=d.C_DocType_ID) "
+ "WHERE C_Payment_ID=?"; + "WHERE C_Payment_ID=?";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null;
try try
{ {
pstmt = DB.prepareStatement (sql, getTrxName()); pstmt = DB.prepareStatement (sql, getTrxName());
pstmt.setInt (1, C_Payment_ID); pstmt.setInt (1, C_Payment_ID);
ResultSet rs = pstmt.executeQuery (); rs = pstmt.executeQuery ();
if (rs.next ()) if (rs.next ())
{ {
setC_BankAccount_ID(rs.getInt(1)); setC_BankAccount_ID(rs.getInt(1));
@ -569,23 +583,15 @@ public class Doc_Allocation extends Doc
accountType = Doc.ACCTTYPE_V_Prepayment; accountType = Doc.ACCTTYPE_V_Prepayment;
} }
} }
rs.close (); }
pstmt.close ();
pstmt = null;
}
catch (Exception e) catch (Exception e)
{ {
log.log(Level.SEVERE, sql, e); log.log(Level.SEVERE, sql, e);
} }
try finally
{ {
if (pstmt != null) DB.close(rs, pstmt);
pstmt.close (); rs = null; pstmt = null;
pstmt = null;
}
catch (Exception e)
{
pstmt = null;
} }
// //