BF [ 1874419 ] JDBC Statement not close in a finally block - fixed for BPartnerValidate

* organized imports for BPartnerValidate
This commit is contained in:
teo_sarca 2008-02-14 07:45:51 +00:00
parent 3c059e91c8
commit 038d0c5142
1 changed files with 16 additions and 17 deletions

View File

@ -16,11 +16,17 @@
*****************************************************************************/
package org.compiere.process;
import java.math.*;
import java.sql.*;
import java.util.logging.*;
import org.compiere.model.*;
import org.compiere.util.*;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.logging.Level;
import org.compiere.model.MBPartner;
import org.compiere.model.MInvoice;
import org.compiere.model.MPayment;
import org.compiere.util.AdempiereUserError;
import org.compiere.util.DB;
import org.compiere.util.Msg;
/**
@ -79,33 +85,26 @@ public class BPartnerValidate extends SvrProcess
{
String sql = "SELECT * FROM C_BPartner WHERE C_BP_Group_ID=? AND IsActive='Y'";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement (sql, get_TrxName());
pstmt.setInt (1, p_C_BP_Group_ID);
ResultSet rs = pstmt.executeQuery ();
rs = pstmt.executeQuery ();
while (rs.next ())
{
MBPartner bp = new MBPartner (getCtx(), rs, get_TrxName());
checkBP (bp);
}
rs.close ();
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
log.log(Level.SEVERE, sql, e);
}
try
finally
{
if (pstmt != null)
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
pstmt = null;
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
}
//