*BF [ 1874419 ] JDBC Statement not close in a finally block - fixed in 2 spots
*Organize imports
This commit is contained in:
parent
c4f0c7a1fa
commit
76ac6d191f
|
@ -16,11 +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.sql.Timestamp;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import java.util.logging.*;
|
import org.compiere.util.CCache;
|
||||||
import org.compiere.util.*;
|
import org.compiere.util.DB;
|
||||||
|
import org.compiere.util.TimeUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RfQ Model
|
* RfQ Model
|
||||||
|
@ -103,30 +108,23 @@ public class MRfQ extends X_C_RfQ
|
||||||
+ "WHERE C_RfQ_ID=? AND IsActive='Y' "
|
+ "WHERE C_RfQ_ID=? AND IsActive='Y' "
|
||||||
+ "ORDER BY Line";
|
+ "ORDER BY Line";
|
||||||
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_RfQ_ID());
|
pstmt.setInt (1, getC_RfQ_ID());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
list.add (new MRfQLine (getCtx(), rs, get_TrxName()));
|
list.add (new MRfQLine (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;
|
|
||||||
}
|
}
|
||||||
MRfQLine[] retValue = new MRfQLine[list.size ()];
|
MRfQLine[] retValue = new MRfQLine[list.size ()];
|
||||||
list.toArray (retValue);
|
list.toArray (retValue);
|
||||||
|
@ -150,30 +148,23 @@ public class MRfQ extends X_C_RfQ
|
||||||
sql += " AND IsComplete='Y'";
|
sql += " AND IsComplete='Y'";
|
||||||
sql += " ORDER BY Price";
|
sql += " ORDER BY Price";
|
||||||
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_RfQ_ID());
|
pstmt.setInt (1, getC_RfQ_ID());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
list.add (new MRfQResponse (getCtx(), rs, get_TrxName()));
|
list.add (new MRfQResponse (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;
|
|
||||||
}
|
}
|
||||||
MRfQResponse[] retValue = new MRfQResponse[list.size ()];
|
MRfQResponse[] retValue = new MRfQResponse[list.size ()];
|
||||||
list.toArray (retValue);
|
list.toArray (retValue);
|
||||||
|
|
Loading…
Reference in New Issue