Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
1.2
-
None
-
None
-
Operating System: All
Platform: All
-
36685
Description
The PooleableConnectionFactory.validateConnection(Connection) throws a NPE, if
the provided SQL statement for validation is invalid itself (e.g. uses a
non-existing table). See the code snippet below. If stmt.executeQuery(query)
throws an SQLException, rset is still null, but will be closed in the finally
block ==> NPE!
if(null != query) {
Statement stmt = null;
ResultSet rset = null;
try {
stmt = conn.createStatement();
rset = stmt.executeQuery(query);
if(!rset.next())
} finally {
try
catch(Exception t)
{ // ignored }try { stmt.close(); } catch(Exception t) { // ignored }
}
}