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