You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Phil Steitz (JIRA)" <ji...@apache.org> on 2006/07/10 07:43:30 UTC

[jira] Updated: (DBCP-3) [dbcp] PoolableConnection.close() won't allow multiple close

     [ http://issues.apache.org/jira/browse/DBCP-3?page=all ]

Phil Steitz updated DBCP-3:
---------------------------

    Bugzilla Id:   (was: 23185)
    Fix Version: 1.3

> [dbcp] PoolableConnection.close() won't allow multiple close
> ------------------------------------------------------------
>
>          Key: DBCP-3
>          URL: http://issues.apache.org/jira/browse/DBCP-3
>      Project: Commons Dbcp
>         Type: Bug

>     Versions: Nightly Builds
>  Environment: Operating System: All
> Platform: All
>     Reporter: Adam Jenkins
>      Fix For: 1.3

>
> Sun's javadoc for java.sql.Connection.close() specifies that calling close on an
> already closed Connection is a no-op.  However, PoolableConnection.close() (v
> 1.10) throws a SQLException if close() is called on a closed Connection. 
> PoolableConnection.close() should just return if the Connection is already
> closed.  Here is a patch:
> To demonstrate the bug, just obtain an open PoolableConnection and call close()
> on it twice; the second call will produce a SQLException.  According to Sun's
> spec, the second close() should just be a no-op.  The current behaviour is
> preferable to the old behaviour where it returned the Connection to the pool
> twice, but it's still not according to the spec.
> Here's a patch:
> *** PoolableConnection.java.orig        2003-09-15 16:07:53.000000000 -0400
> --- PoolableConnection.java     2003-09-15 16:08:11.000000000 -0400
> ***************
> *** 108,114 ****
>        */
>        public synchronized void close() throws SQLException {
>           if(isClosed()) {
> !             throw new SQLException("Already closed.");
>           } else {
>               try {
>                   _pool.returnObject(this);
> --- 108,114 ----
>        */
>        public synchronized void close() throws SQLException {
>           if(isClosed()) {
> !             return;
>           } else {
>               try {
>                   _pool.returnObject(this);

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org