Author: markt Date: Wed Sep 15 11:42:55 2010 New Revision: 997291 URL: http://svn.apache.org/viewvc?rev=997291&view=rev Log: 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.
Modified: tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Modified: tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=997291&r1=997290&r2=997291&view=diff ============================================================================== --- tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java (original) +++ tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Wed Sep 15 11:42:55 2010 @@ -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); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org