*BF [ 1874419 ] JDBC Statement not close in a finally block - fixed in 2 spots
This commit is contained in:
parent
4da0bc719d
commit
7a7bf13e74
|
@ -145,31 +145,24 @@ public final class MRole extends X_AD_Role
|
|||
{
|
||||
String sql = "SELECT * FROM AD_Role WHERE AD_Client_ID=?";
|
||||
ArrayList<MRole> list = new ArrayList<MRole> ();
|
||||
PreparedStatement pstmt = null;
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, null);
|
||||
pstmt.setInt (1, Env.getAD_Client_ID(ctx));
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
list.add (new MRole(ctx, rs, null));
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
pstmt = null;
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
MRole[] retValue = new MRole[list.size ()];
|
||||
list.toArray (retValue);
|
||||
|
@ -188,30 +181,23 @@ public final class MRole extends X_AD_Role
|
|||
if (whereClause != null && whereClause.length() > 0)
|
||||
sql += " WHERE " + whereClause;
|
||||
ArrayList<MRole> list = new ArrayList<MRole> ();
|
||||
PreparedStatement pstmt = null;
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, null);
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
list.add (new MRole(ctx, rs, null));
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
pstmt = null;
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
MRole[] retValue = new MRole[list.size ()];
|
||||
list.toArray (retValue);
|
||||
|
@ -789,36 +775,29 @@ public final class MRole extends X_AD_Role
|
|||
+ "WHERE IsActive='Y' AND AD_Org_ID IN (SELECT Node_ID FROM "
|
||||
+ tree.getNodeTableName()
|
||||
+ " WHERE AD_Tree_ID=? AND Parent_ID=? AND IsActive='Y')";
|
||||
PreparedStatement pstmt = null;
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||
pstmt.setInt (1, tree.getAD_Tree_ID());
|
||||
pstmt.setInt(2, org.getAD_Org_ID());
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
{
|
||||
int AD_Client_ID = rs.getInt(1);
|
||||
int AD_Org_ID = rs.getInt(2);
|
||||
loadOrgAccessAdd (list, new OrgAccess(AD_Client_ID, AD_Org_ID, oa.readOnly));
|
||||
}
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log (Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
pstmt = null;
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
} // loadOrgAccessAdd
|
||||
|
||||
|
|
Loading…
Reference in New Issue