commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r734472 - /commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolingConnection.java
Date Wed, 14 Jan 2009 18:35:32 GMT
Author: sebb
Date: Wed Jan 14 10:35:32 2009
New Revision: 734472

URL: http://svn.apache.org/viewvc?rev=734472&view=rev
Log:
Replace generic caught Exception with specific SQLException
Replace deprecated SQLNestedException with equivalent code

Modified:
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolingConnection.java

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolingConnection.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolingConnection.java?rev=734472&r1=734471&r2=734472&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolingConnection.java (original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolingConnection.java Wed
Jan 14 10:35:32 2009
@@ -77,7 +77,7 @@
             } catch(SQLException e) {
                 throw e;
             } catch(Exception e) {
-                throw new SQLNestedException("Cannot close connection", e);
+                throw (SQLException) new SQLException("Cannot close connection").initCause(e);
             }
         }
         getInnermostDelegate().close();
@@ -95,7 +95,7 @@
         try {
             return(PreparedStatement)(_pstmtPool.borrowObject(createKey(sql)));
         } catch(NoSuchElementException e) {
-            throw new SQLNestedException("MaxOpenPreparedStatements limit reached", e); 
+            throw (SQLException) new SQLException("MaxOpenPreparedStatements limit reached").initCause(e);

         } catch(RuntimeException e) {
             throw e;
         } catch(Exception e) {
@@ -115,11 +115,11 @@
         try {
             return(PreparedStatement)(_pstmtPool.borrowObject(createKey(sql,resultSetType,resultSetConcurrency)));
         } catch(NoSuchElementException e) {
-            throw new SQLNestedException("MaxOpenPreparedStatements limit reached", e); 
+            throw (SQLException) new SQLException("MaxOpenPreparedStatements limit reached").initCause(e);

         } catch(RuntimeException e) {
             throw e;
         } catch(Exception e) {
-            throw new SQLNestedException("Borrow prepareStatement from pool failed", e);
+            throw (SQLException) new SQLException("Borrow prepareStatement from pool failed").initCause(e);
         }
     }
 
@@ -163,7 +163,7 @@
         String catalog = null;
         try {
             catalog = getCatalog();
-        } catch (Exception e) {}
+        } catch (SQLException e) {}
         return new PStmtKey(normalizeSQL(sql), catalog, resultSetType, resultSetConcurrency);
     }
 
@@ -174,7 +174,7 @@
         String catalog = null;
         try {
             catalog = getCatalog();
-        } catch (Exception e) {}
+        } catch (SQLException e) {}
         return new PStmtKey(normalizeSQL(sql), catalog);
     }
 



Mime
View raw message