commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r736858 - in /commons/proper/dbcp/trunk/src: java/org/apache/commons/dbcp/ java/org/apache/commons/dbcp/cpdsadapter/ java/org/apache/commons/dbcp/datasources/ java/org/apache/commons/dbcp/managed/ test/org/apache/commons/dbcp/
Date Fri, 23 Jan 2009 00:00:38 GMT
Author: sebb
Date: Thu Jan 22 16:00:37 2009
New Revision: 736858

URL: http://svn.apache.org/viewvc?rev=736858&view=rev
Log:
Revert SQLNestedException changes from r734481

Modified:
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/BasicDataSource.java
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolablePreparedStatement.java
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolingConnection.java
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolingDataSource.java
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/cpdsadapter/PooledConnectionImpl.java
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/CPDSConnectionFactory.java
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/InstanceKeyDataSource.java
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/KeyedCPDSConnectionFactory.java
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/PerUserPoolDataSource.java
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/SharedPoolDataSource.java
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/managed/BasicManagedDataSource.java
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterConnection.java

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/BasicDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/BasicDataSource.java?rev=736858&r1=736857&r2=736858&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/BasicDataSource.java (original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/BasicDataSource.java Thu Jan
22 16:00:37 2009
@@ -1150,7 +1150,7 @@
         } catch(RuntimeException e) {
             throw e;
         } catch(Exception e) {
-            throw (SQLException) new SQLException("Cannot close connection pool").initCause(e);
+            throw new SQLNestedException("Cannot close connection pool", e);
         }
     }
 

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolablePreparedStatement.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolablePreparedStatement.java?rev=736858&r1=736857&r2=736858&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolablePreparedStatement.java
(original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolablePreparedStatement.java
Thu Jan 22 16:00:37 2009
@@ -81,7 +81,7 @@
             } catch(RuntimeException e) {
                 throw e;
             } catch(Exception e) {
-                throw (SQLException) new SQLException("Cannot close preparedstatement (return
to pool failed)").initCause(e);
+                throw new SQLNestedException("Cannot close preparedstatement (return to pool
failed)", e);
             }
         }
     }

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=736858&r1=736857&r2=736858&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 Thu
Jan 22 16:00:37 2009
@@ -99,7 +99,7 @@
         } catch(RuntimeException e) {
             throw e;
         } catch(Exception e) {
-            throw (SQLException) new SQLException("Borrow prepareStatement from pool failed").initCause(e);
+            throw new SQLNestedException("Borrow prepareStatement from pool failed", e);
         }
     }
 

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolingDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolingDataSource.java?rev=736858&r1=736857&r2=736858&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolingDataSource.java (original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolingDataSource.java Thu
Jan 22 16:00:37 2009
@@ -111,11 +111,11 @@
         } catch(SQLException e) {
             throw e;
         } catch(NoSuchElementException e) {
-            throw (SQLException) new SQLException("Cannot get a connection, pool error "
+ e.getMessage()).initCause(e);
+            throw new SQLNestedException("Cannot get a connection, pool error " + e.getMessage(),
e);
         } catch(RuntimeException e) {
             throw e;
         } catch(Exception e) {
-            throw (SQLException) new SQLException("Cannot get a connection, general error").initCause(e);
+            throw new SQLNestedException("Cannot get a connection, general error", e);
         }
     }
 

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/cpdsadapter/PooledConnectionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/cpdsadapter/PooledConnectionImpl.java?rev=736858&r1=736857&r2=736858&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/cpdsadapter/PooledConnectionImpl.java
(original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/cpdsadapter/PooledConnectionImpl.java
Thu Jan 22 16:00:37 2009
@@ -32,6 +32,7 @@
 
 import org.apache.commons.dbcp.DelegatingConnection;
 import org.apache.commons.dbcp.DelegatingPreparedStatement;
+import org.apache.commons.dbcp.SQLNestedException;
 import org.apache.commons.pool.KeyedObjectPool;
 import org.apache.commons.pool.KeyedPoolableObjectFactory;
 
@@ -137,7 +138,7 @@
         } catch (RuntimeException e) {
             throw e;
         } catch (Exception e) {
-            throw (SQLException) new SQLException("Cannot close connection (return to pool
failed)").initCause(e);
+            throw new SQLNestedException("Cannot close connection (return to pool failed)",
e);
         } finally {
             try {
                 connection.close();
@@ -237,7 +238,7 @@
             } catch (RuntimeException e) {
                 throw e;
             } catch (Exception e) {
-                throw (SQLException) new SQLException("Borrow prepareStatement from pool
failed").initCause(e);
+                throw new SQLNestedException("Borrow prepareStatement from pool failed",
e);
             }
         }
     }
@@ -258,7 +259,7 @@
             } catch (RuntimeException e) {
                 throw e;
             } catch (Exception e) {
-                throw (SQLException) new SQLException("Borrow prepareStatement from pool
failed").initCause(e);
+                throw new SQLNestedException("Borrow prepareStatement from pool failed",
e);
             }
         }
     }

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/CPDSConnectionFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/CPDSConnectionFactory.java?rev=736858&r1=736857&r2=736858&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/CPDSConnectionFactory.java
(original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/CPDSConnectionFactory.java
Thu Jan 22 16:00:37 2009
@@ -30,6 +30,7 @@
 import javax.sql.ConnectionPoolDataSource;
 import javax.sql.PooledConnection;
 
+import org.apache.commons.dbcp.SQLNestedException;
 import org.apache.commons.pool.ObjectPool;
 import org.apache.commons.pool.PoolableObjectFactory;
 
@@ -155,7 +156,7 @@
             } catch (RuntimeException e) {
                 throw e;
             } catch (Exception e) {
-                throw (SQLException) new SQLException("Cannot set the pool on this factory").initCause(e);
+                throw new SQLNestedException("Cannot set the pool on this factory", e);
             }
         }
         _pool = pool;

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/InstanceKeyDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/InstanceKeyDataSource.java?rev=736858&r1=736857&r2=736858&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/InstanceKeyDataSource.java
(original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/InstanceKeyDataSource.java
Thu Jan 22 16:00:37 2009
@@ -34,6 +34,7 @@
 import javax.sql.DataSource;
 import javax.sql.PooledConnection;
 
+import org.apache.commons.dbcp.SQLNestedException;
 import org.apache.commons.pool.impl.GenericObjectPool;
 
 /**
@@ -678,7 +679,7 @@
             info = getPooledConnectionAndInfo(username, password);
         } catch (NoSuchElementException e) {
             closeDueToException(info);
-            throw (SQLException) new SQLException("Cannot borrow connection from pool").initCause(e);
+            throw new SQLNestedException("Cannot borrow connection from pool", e);
         } catch (RuntimeException e) {
             closeDueToException(info);
             throw e;
@@ -687,7 +688,7 @@
             throw e;
         } catch (Exception e) {
             closeDueToException(info);
-            throw (SQLException) new SQLException("Cannot borrow connection from pool").initCause(e);
+            throw new SQLNestedException("Cannot borrow connection from pool", e);
         }
         
         if (!(null == password ? null == info.getPassword() 

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/KeyedCPDSConnectionFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/KeyedCPDSConnectionFactory.java?rev=736858&r1=736857&r2=736858&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/KeyedCPDSConnectionFactory.java
(original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/KeyedCPDSConnectionFactory.java
Thu Jan 22 16:00:37 2009
@@ -31,6 +31,7 @@
 import javax.sql.ConnectionPoolDataSource;
 import javax.sql.PooledConnection;
 
+import org.apache.commons.dbcp.SQLNestedException;
 import org.apache.commons.pool.KeyedObjectPool;
 import org.apache.commons.pool.KeyedPoolableObjectFactory;
 
@@ -149,7 +150,7 @@
             } catch (RuntimeException e) {
                 throw e;
             } catch (Exception e) {
-                throw (SQLException) new SQLException("Cannot set the pool on this factory").initCause(e);
+                throw new SQLNestedException("Cannot set the pool on this factory", e);
             }
         }
         _pool = pool;

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/PerUserPoolDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/PerUserPoolDataSource.java?rev=736858&r1=736857&r2=736858&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/PerUserPoolDataSource.java
(original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/PerUserPoolDataSource.java
Thu Jan 22 16:00:37 2009
@@ -32,6 +32,7 @@
 
 import org.apache.commons.pool.ObjectPool;
 import org.apache.commons.pool.impl.GenericObjectPool;
+import org.apache.commons.dbcp.SQLNestedException;
 
 /**
  * <p>
@@ -372,7 +373,7 @@
                 registerPool(username, password);
                 pool = pools.get(key);
             } catch (NamingException e) {
-                throw (SQLException) new SQLException("RegisterPool failed").initCause(e);
+                throw new SQLNestedException("RegisterPool failed", e);
             }
         }
 
@@ -381,8 +382,8 @@
             info = (PooledConnectionAndInfo)((ObjectPool) pool).borrowObject();
         }
         catch (Exception e) {
-            throw (SQLException) new SQLException(
-                "Could not retrieve connection info from pool").initCause(e);
+            throw new SQLNestedException(
+                "Could not retrieve connection info from pool", e);
         }
         
         return info;

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/SharedPoolDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/SharedPoolDataSource.java?rev=736858&r1=736857&r2=736858&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/SharedPoolDataSource.java
(original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/SharedPoolDataSource.java
Thu Jan 22 16:00:37 2009
@@ -31,6 +31,7 @@
 import org.apache.commons.pool.KeyedObjectPool;
 import org.apache.commons.pool.impl.GenericKeyedObjectPool;
 import org.apache.commons.pool.impl.GenericObjectPool;
+import org.apache.commons.dbcp.SQLNestedException;
 
 /**
  * A pooling <code>DataSource</code> appropriate for deployment within
@@ -157,7 +158,7 @@
             try {
                 registerPool(username, password);
             } catch (NamingException e) {
-                throw (SQLException) new SQLException("RegisterPool failed").initCause(e);
+                throw new SQLNestedException("RegisterPool failed", e);
             }
         }
 
@@ -170,12 +171,12 @@
             if ((userKeys != null) && (userKeys.containsKey(username))) {
                 userKeys.remove(username);
             }
-            throw (SQLException) new SQLException(
-                "Could not retrieve connection info from pool").initCause(ex);
+            throw new SQLNestedException(
+                "Could not retrieve connection info from pool", ex);
         }
         catch (Exception e) {
-            throw (SQLException) new SQLException(
-                "Could not retrieve connection info from pool").initCause(e);
+            throw new SQLNestedException(
+                "Could not retrieve connection info from pool", e);
         }
         return info;
     }

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/managed/BasicManagedDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/managed/BasicManagedDataSource.java?rev=736858&r1=736857&r2=736858&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/managed/BasicManagedDataSource.java
(original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/managed/BasicManagedDataSource.java
Thu Jan 22 16:00:37 2009
@@ -20,6 +20,7 @@
 import org.apache.commons.dbcp.BasicDataSource;
 import org.apache.commons.dbcp.ConnectionFactory;
 import org.apache.commons.dbcp.PoolingDataSource;
+import org.apache.commons.dbcp.SQLNestedException;
 
 import javax.sql.XADataSource;
 import javax.transaction.TransactionManager;
@@ -109,7 +110,7 @@
             String message = "Cannot load XA data source class '" + xaDataSource + "'";
             logWriter.println(message);
             t.printStackTrace(logWriter);
-            throw (SQLException) new SQLException(message).initCause(t);
+            throw new SQLNestedException(message, t);
         }
 
         // Create the xa data source instance
@@ -120,7 +121,7 @@
             String message = "Cannot create XA data source of class '" + xaDataSource + "'";
             logWriter.println(message);
             t.printStackTrace(logWriter);
-            throw (SQLException) new SQLException(message).initCause(t);
+            throw new SQLNestedException(message, t);
         }
 
         // finally, create the XAConectionFactory using the XA data source

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterConnection.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterConnection.java?rev=736858&r1=736857&r2=736858&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterConnection.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterConnection.java Thu Jan
22 16:00:37 2009
@@ -212,7 +212,7 @@
     
     protected void checkFailure() throws SQLException {
         if (failure != null) {
-            throw (SQLException) new SQLException("TesterConnection failure").initCause(failure);
+            throw new SQLNestedException("TesterConnection failure", failure);
         }
     }
     



Mime
View raw message