[ 1874419 ] JDBC Statement not close in a finally block
This commit is contained in:
parent
1873121a4e
commit
7891512128
|
@ -1035,11 +1035,12 @@ public class MSequence extends X_AD_Sequence
|
|||
boolean success = true;
|
||||
//
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, trxName);
|
||||
pstmt.setInt(1, AD_Client_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
String tableName = rs.getString(1);
|
||||
|
@ -1054,22 +1055,15 @@ public class MSequence extends X_AD_Sequence
|
|||
success = false;
|
||||
}
|
||||
}
|
||||
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)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
s_log.info ("AD_Client_ID=" + AD_Client_ID
|
||||
|
@ -1122,31 +1116,25 @@ public class MSequence extends X_AD_Sequence
|
|||
+ " AND IsTableID='Y'";
|
||||
MSequence retValue = null;
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, trxName);
|
||||
pstmt.setString (1, tableName.toUpperCase());
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
if (rs.next ())
|
||||
retValue = new MSequence (ctx, rs, trxName);
|
||||
if (rs.next())
|
||||
s_log.log(Level.SEVERE, "More then one sequence for " + tableName);
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, "get", e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
return retValue;
|
||||
|
|
Loading…
Reference in New Issue