BF [ 1874419 ] JDBC Statement not close in a finally block

This commit is contained in:
teo_sarca 2008-01-24 10:09:59 +00:00
parent 757bec9e02
commit bef274f45e
1 changed files with 5 additions and 12 deletions

View File

@ -565,30 +565,23 @@ public class MPrintTableFormat extends X_AD_PrintTableFormat
+ "ORDER BY IsDefault DESC, AD_Client_ID DESC"; + "ORDER BY IsDefault DESC, AD_Client_ID DESC";
int AD_Client_ID = Env.getAD_Client_ID(ctx); int AD_Client_ID = Env.getAD_Client_ID(ctx);
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null;
try try
{ {
pstmt = DB.prepareStatement(sql, null); pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, AD_Client_ID); pstmt.setInt(1, AD_Client_ID);
ResultSet rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
tf = new MPrintTableFormat (ctx, rs, null); tf = new MPrintTableFormat (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;
} }
return tf; return tf;
} // get } // get