commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From di...@apache.org
Subject cvs commit: jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/cpdsadapter PooledConnectionImpl.java
Date Mon, 11 Aug 2003 16:01:47 GMT
dirkv       2003/08/11 09:01:47

  Modified:    dbcp/src/java/org/apache/commons/dbcp/cpdsadapter
                        PooledConnectionImpl.java
  Log:
  use SQLNestedException for improved error messages
  
  Revision  Changes    Path
  1.7       +7 -8      jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/cpdsadapter/PooledConnectionImpl.java
  
  Index: PooledConnectionImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/cpdsadapter/PooledConnectionImpl.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- PooledConnectionImpl.java	29 Jun 2003 12:42:16 -0000	1.6
  +++ PooledConnectionImpl.java	11 Aug 2003 16:01:47 -0000	1.7
  @@ -65,6 +65,7 @@
   import javax.sql.PooledConnection;
   
   import org.apache.commons.dbcp.DelegatingPreparedStatement;
  +import org.apache.commons.dbcp.SQLNestedException;
   import org.apache.commons.pool.KeyedObjectPool;
   import org.apache.commons.pool.KeyedPoolableObjectFactory;
   
  @@ -144,12 +145,10 @@
                       pstmtPool = null;
                   }
               }
  +        } catch (RuntimeException e) {
  +            throw e;
           } catch (Exception e) {
  -            if (e instanceof RuntimeException) {
  -                throw (RuntimeException)e;
  -            } else {
  -                throw new SQLException(e.getMessage());
  -            }
  +            throw new SQLNestedException("Cannot close connection (return to pool failed)",
e);
           } finally {
               connection.close();
           }
  @@ -239,7 +238,7 @@
               } catch (RuntimeException e) {
                   throw e;
               } catch (Exception e) {
  -                throw new SQLException(e.toString());
  +                throw new SQLNestedException("Borrow prepareStatement from pool failed",
e);
               }
           }
       }
  @@ -260,7 +259,7 @@
               } catch (RuntimeException e) {
                   throw e;
               } catch (Exception e) {
  -                throw new SQLException(e.toString());
  +                throw new SQLNestedException("Borrow prepareStatement from pool failed",
e);
               }
           }
       }
  
  
  

Mime
View raw message