From: markt Date: Wed, 15 Sep 2010 11:42:55 +0000 (+0000) Subject: Address a concern raised in https://issues.apache.org/bugzilla/show_bug.cgi?id=49584 X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=fb0f34d505daedc58ba786d2884dc2ef4d6c255f;p=tomcat7.0 Address a concern raised in https://issues.apache.org/bugzilla/show_bug.cgi?id=49584 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 --- diff --git a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java index 9b9984b7a..81a87796d 100644 --- a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java +++ b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java @@ -605,12 +605,13 @@ public class ConnectionPool { * @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)) { @@ -640,6 +641,7 @@ public class ConnectionPool { throw ex; } } finally { + // con can never be null here if (error ) { release(con); }