fix for calling close multiple times
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 13 Nov 2008 18:59:24 +0000 (18:59 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 13 Nov 2008 18:59:24 +0000 (18:59 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@713787 13f79535-47bb-0310-9956-ffa450edef68

modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ProxyConnection.java

index 871a56e..5c72367 100644 (file)
@@ -71,8 +71,8 @@ public class ProxyConnection extends JdbcInterceptor {
         if (ISCLOSED_VAL==method.getName()) {
             return isClosed();
         }
-        if (isClosed()) throw new SQLException("Connection has already been closed.");
         if (CLOSE_VAL==method.getName()) {
+            if (isClosed()) return null; //noop for already closed.
             PooledConnection poolc = this.connection;
             this.connection = null;
             pool.returnConnection(poolc);
@@ -80,6 +80,7 @@ public class ProxyConnection extends JdbcInterceptor {
         } else if (TOSTRING_VAL==method.getName()) {
             return this.toString();
         }
+        if (isClosed()) throw new SQLException("Connection has already been closed.");
         return method.invoke(connection.getConnection(),args);
     }