Re-factor code to clarify con is never null when release is called.
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@997291
13f79535-47bb-0310-9956-
ffa450edef68
* @return a PooledConnection that has been connected
* @throws SQLException
*/
- protected PooledConnection createConnection(long now, PooledConnection con) throws SQLException {
+ protected PooledConnection createConnection(long now,
+ PooledConnection notUsed) throws SQLException {
//no connections where available we'll create one
+ PooledConnection con = create();
boolean error = false;
try {
//connect and validate the connection
- con = create();
con.lock();
con.connect();
if (con.validate(PooledConnection.VALIDATE_INIT)) {
throw ex;
}
} finally {
+ // con can never be null here
if (error ) {
release(con);
}