You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Greg Steuck <gr...@nest.cx> on 2003/02/06 23:27:22 UTC

AbstractJdbcConnection.close may lose connections

Hello,

If I am not mistaken, connections may not be returned to pool nor
disposed of if clearWarnings() in close() throws a SQLException. Could
somebody comment on the validity of the following patch or explain why
it is not necessary?

Index: AbstractJdbcConnection.java
===================================================================
RCS file: /home/cvspublic/avalon-excalibur/datasource/src/java/org/apache/avalon/excalibur/datasource/AbstractJdbcConnection.java,v
retrieving revision 1.21
diff -u -c -r1.21 AbstractJdbcConnection.java
*** AbstractJdbcConnection.java	8 Nov 2002 03:24:27 -0000	1.21
--- AbstractJdbcConnection.java	6 Feb 2003 22:19:10 -0000
***************
*** 157,164 ****
      public void close()
          throws SQLException
      {
!         clearWarnings();
!         m_pool.put( this );
      }
  
      public void dispose()
--- 157,174 ----
      public void close()
          throws SQLException
      {
!         try
!         {
!             clearWarnings();
!             m_pool.put( this );
!         }
!         catch ( SQLException se )
!         {
!             // gets rid of connections that throw SQLException during
!             // clean up
!             getLogger.error( "Connection could not be recycled", se );
!             this.dispose();
!         }
      }
  
      public void dispose()

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