Bugs-1874419 ] JDBC Statement not close in a finally block

Trying out another case for review.

Tested call of the method - ok.
This commit is contained in:
Redhuan D. Oon 2008-02-01 12:30:52 +00:00
parent 5d2f5de9c2
commit 070b7a20ea
1 changed files with 8 additions and 19 deletions

View File

@ -1008,11 +1008,12 @@ public final class AEnv
log.config(sqlRolePermission); log.config(sqlRolePermission);
PreparedStatement prolestmt = null; PreparedStatement prolestmt = null;
ResultSet rs = null;
try try
{ {
prolestmt = DB.prepareStatement (sqlRolePermission, null); prolestmt = DB.prepareStatement (sqlRolePermission, null);
ResultSet rs = prolestmt.executeQuery (); rs = prolestmt.executeQuery ();
rs.next(); rs.next();
@ -1024,29 +1025,17 @@ public final class AEnv
{ {
return false; return false;
} }
rs.close ();
prolestmt.close ();
prolestmt = null;
} }
catch (Exception e) catch (Exception e)
{ {
System.out.println(e); System.out.println(e);
log.log(Level.SEVERE, "(1)", e); log.log(Level.SEVERE, "(1)", e);
}
try
{
if (prolestmt != null)
{
prolestmt.close ();
}
prolestmt = null;
} }
catch (Exception e) finally
{ {
prolestmt = null; DB.close(rs, prolestmt);
} rs = null; prolestmt = null;
}
return result; return result;
} // canAccessInfo } // canAccessInfo