*BF [ 1874419 ] JDBC Statement not close in a finally block
Organize Imports
This commit is contained in:
parent
e9675e3e9d
commit
dc20d4e7b3
|
|
@ -16,10 +16,16 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.model;
|
package org.compiere.model;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.PreparedStatement;
|
||||||
import java.util.*;
|
import java.sql.ResultSet;
|
||||||
import java.util.logging.*;
|
import java.sql.Timestamp;
|
||||||
import org.compiere.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.compiere.util.CLogger;
|
||||||
|
import org.compiere.util.DB;
|
||||||
|
import org.compiere.util.Msg;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -41,29 +47,22 @@ public class MAcctProcessor extends X_C_AcctProcessor
|
||||||
ArrayList<MAcctProcessor> list = new ArrayList<MAcctProcessor>();
|
ArrayList<MAcctProcessor> list = new ArrayList<MAcctProcessor>();
|
||||||
String sql = "SELECT * FROM C_AcctProcessor WHERE IsActive='Y'";
|
String sql = "SELECT * FROM C_AcctProcessor WHERE IsActive='Y'";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, null);
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
list.add (new MAcctProcessor (ctx, rs, null));
|
list.add (new MAcctProcessor (ctx, rs, null));
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, "getActive", e);
|
s_log.log(Level.SEVERE, "getActive", e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
{
|
||||||
if (pstmt != null)
|
DB.close(rs, pstmt);
|
||||||
pstmt.close ();
|
rs = null; pstmt = null;
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
MAcctProcessor[] retValue = new MAcctProcessor[list.size ()];
|
MAcctProcessor[] retValue = new MAcctProcessor[list.size ()];
|
||||||
list.toArray (retValue);
|
list.toArray (retValue);
|
||||||
|
|
@ -153,30 +152,23 @@ public class MAcctProcessor extends X_C_AcctProcessor
|
||||||
+ "WHERE C_AcctProcessor_ID=? "
|
+ "WHERE C_AcctProcessor_ID=? "
|
||||||
+ "ORDER BY Created DESC";
|
+ "ORDER BY Created DESC";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||||
pstmt.setInt (1, getC_AcctProcessor_ID());
|
pstmt.setInt (1, getC_AcctProcessor_ID());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
list.add (new MAcctProcessorLog (getCtx(), rs, get_TrxName()));
|
list.add (new MAcctProcessorLog (getCtx(), rs, get_TrxName()));
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
MAcctProcessorLog[] retValue = new MAcctProcessorLog[list.size ()];
|
MAcctProcessorLog[] retValue = new MAcctProcessorLog[list.size ()];
|
||||||
list.toArray (retValue);
|
list.toArray (retValue);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue