BF [ 1874419 ] JDBC Statement not close in a finally block
This commit is contained in:
parent
f2e82970e0
commit
705c78d33d
|
@ -134,9 +134,11 @@ public class MAccount extends X_C_ValidCombination
|
||||||
sql.append(" AND UserElement2_ID=?");
|
sql.append(" AND UserElement2_ID=?");
|
||||||
sql.append(" AND IsActive='Y'");
|
sql.append(" AND IsActive='Y'");
|
||||||
// sql.append(" ORDER BY IsFullyQualified DESC");
|
// sql.append(" ORDER BY IsFullyQualified DESC");
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), null);
|
pstmt = DB.prepareStatement(sql.toString(), null);
|
||||||
// -- Mandatory Accounting fields
|
// -- Mandatory Accounting fields
|
||||||
int index = 1;
|
int index = 1;
|
||||||
pstmt.setInt(index++, AD_Client_ID);
|
pstmt.setInt(index++, AD_Client_ID);
|
||||||
|
@ -179,16 +181,18 @@ public class MAccount extends X_C_ValidCombination
|
||||||
if (UserElement2_ID != 0)
|
if (UserElement2_ID != 0)
|
||||||
pstmt.setInt(index++, UserElement2_ID);
|
pstmt.setInt(index++, UserElement2_ID);
|
||||||
//
|
//
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
existingAccount = new MAccount (ctx, rs, null);
|
existingAccount = new MAccount (ctx, rs, null);
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch(SQLException e)
|
catch(SQLException e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, info + "\n" + sql, e);
|
s_log.log(Level.SEVERE, info + "\n" + sql, e);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
}
|
||||||
// Existing
|
// Existing
|
||||||
if (existingAccount != null)
|
if (existingAccount != null)
|
||||||
return existingAccount;
|
return existingAccount;
|
||||||
|
|
Loading…
Reference in New Issue