*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=?";
|
String sql = "SELECT * FROM AD_Role WHERE AD_Client_ID=?";
|
||||||
ArrayList<MRole> list = new ArrayList<MRole> ();
|
ArrayList<MRole> list = new ArrayList<MRole> ();
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, null);
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
pstmt.setInt (1, Env.getAD_Client_ID(ctx));
|
pstmt.setInt (1, Env.getAD_Client_ID(ctx));
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
list.add (new MRole(ctx, rs, null));
|
list.add (new MRole(ctx, rs, null));
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, sql, e);
|
s_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;
|
|
||||||
}
|
}
|
||||||
MRole[] retValue = new MRole[list.size ()];
|
MRole[] retValue = new MRole[list.size ()];
|
||||||
list.toArray (retValue);
|
list.toArray (retValue);
|
||||||
|
|
@ -188,30 +181,23 @@ public final class MRole extends X_AD_Role
|
||||||
if (whereClause != null && whereClause.length() > 0)
|
if (whereClause != null && whereClause.length() > 0)
|
||||||
sql += " WHERE " + whereClause;
|
sql += " WHERE " + whereClause;
|
||||||
ArrayList<MRole> list = new ArrayList<MRole> ();
|
ArrayList<MRole> list = new ArrayList<MRole> ();
|
||||||
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 MRole(ctx, rs, null));
|
list.add (new MRole(ctx, rs, null));
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, sql, e);
|
s_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;
|
|
||||||
}
|
}
|
||||||
MRole[] retValue = new MRole[list.size ()];
|
MRole[] retValue = new MRole[list.size ()];
|
||||||
list.toArray (retValue);
|
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 "
|
+ "WHERE IsActive='Y' AND AD_Org_ID IN (SELECT Node_ID FROM "
|
||||||
+ tree.getNodeTableName()
|
+ tree.getNodeTableName()
|
||||||
+ " WHERE AD_Tree_ID=? AND Parent_ID=? AND IsActive='Y')";
|
+ " WHERE AD_Tree_ID=? AND Parent_ID=? AND IsActive='Y')";
|
||||||
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, tree.getAD_Tree_ID());
|
pstmt.setInt (1, tree.getAD_Tree_ID());
|
||||||
pstmt.setInt(2, org.getAD_Org_ID());
|
pstmt.setInt(2, org.getAD_Org_ID());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
int AD_Client_ID = rs.getInt(1);
|
int AD_Client_ID = rs.getInt(1);
|
||||||
int AD_Org_ID = rs.getInt(2);
|
int AD_Org_ID = rs.getInt(2);
|
||||||
loadOrgAccessAdd (list, new OrgAccess(AD_Client_ID, AD_Org_ID, oa.readOnly));
|
loadOrgAccessAdd (list, new OrgAccess(AD_Client_ID, AD_Org_ID, oa.readOnly));
|
||||||
}
|
}
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
} // loadOrgAccessAdd
|
} // loadOrgAccessAdd
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue