commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r734481 - 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 Wed, 14 Jan 2009 18:55:39 GMT
Author: sebb
Date: Wed Jan 14 10:55:39 2009
New Revision: 734481

URL: http://svn.apache.org/viewvc?rev=734481&view=rev
Log:
Replace deprecated SQLNestedException with equivalent code

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=734481&r1=734480&r2=734481&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 Wed Jan
14 10:55:39 2009
@@ -1150,7 +1150,7 @@
         } catch(RuntimeException e) {
             throw e;
         } catch(Exception e) {
-            throw new SQLNestedException("Cannot close connection pool", e);
+            throw (SQLException) new SQLException("Cannot close connection pool").initCause(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=734481&r1=734480&r2=734481&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
Wed Jan 14 10:55:39 2009
@@ -81,7 +81,7 @@
             } catch(RuntimeException e) {
                 throw e;
             } catch(Exception e) {
-                throw new SQLNestedException("Cannot close preparedstatement (return to pool
failed)", e);
+                throw (SQLException) new SQLException("Cannot close preparedstatement (return
to pool failed)").initCause(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=734481&r1=734480&r2=734481&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:55:39 2009
@@ -99,7 +99,7 @@
         } 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);
         }
     }
 

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=734481&r1=734480&r2=734481&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 Wed
Jan 14 10:55:39 2009
@@ -111,11 +111,11 @@
         } catch(SQLException e) {
             throw e;
         } catch(NoSuchElementException e) {
-            throw new SQLNestedException("Cannot get a connection, pool error " + e.getMessage(),
e);
+            throw (SQLException) new SQLException("Cannot get a connection, pool error "
+ e.getMessage()).initCause(e);
         } catch(RuntimeException e) {
             throw e;
         } catch(Exception e) {
-            throw new SQLNestedException("Cannot get a connection, general error", e);
+            throw (SQLException) new SQLException("Cannot get a connection, general error").initCause(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=734481&r1=734480&r2=734481&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
Wed Jan 14 10:55:39 2009
@@ -32,7 +32,6 @@
 
 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;
 
@@ -138,7 +137,7 @@
         } catch (RuntimeException e) {
             throw e;
         } catch (Exception e) {
-            throw new SQLNestedException("Cannot close connection (return to pool failed)",
e);
+            throw (SQLException) new SQLException("Cannot close connection (return to pool
failed)").initCause(e);
         } finally {
             try {
                 connection.close();
@@ -238,7 +237,7 @@
             } 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);
             }
         }
     }
@@ -259,7 +258,7 @@
             } 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);
             }
         }
     }

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=734481&r1=734480&r2=734481&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
Wed Jan 14 10:55:39 2009
@@ -30,7 +30,6 @@
 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;
 
@@ -156,7 +155,7 @@
             } catch (RuntimeException e) {
                 throw e;
             } catch (Exception e) {
-                throw new SQLNestedException("Cannot set the pool on this factory", e);
+                throw (SQLException) new SQLException("Cannot set the pool on this factory").initCause(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=734481&r1=734480&r2=734481&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
Wed Jan 14 10:55:39 2009
@@ -34,7 +34,6 @@
 import javax.sql.DataSource;
 import javax.sql.PooledConnection;
 
-import org.apache.commons.dbcp.SQLNestedException;
 import org.apache.commons.pool.impl.GenericObjectPool;
 
 /**
@@ -679,7 +678,7 @@
             info = getPooledConnectionAndInfo(username, password);
         } catch (NoSuchElementException e) {
             closeDueToException(info);
-            throw new SQLNestedException("Cannot borrow connection from pool", e);
+            throw (SQLException) new SQLException("Cannot borrow connection from pool").initCause(e);
         } catch (RuntimeException e) {
             closeDueToException(info);
             throw e;
@@ -688,7 +687,7 @@
             throw e;
         } catch (Exception e) {
             closeDueToException(info);
-            throw new SQLNestedException("Cannot borrow connection from pool", e);
+            throw (SQLException) new SQLException("Cannot borrow connection from pool").initCause(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=734481&r1=734480&r2=734481&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
Wed Jan 14 10:55:39 2009
@@ -31,7 +31,6 @@
 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;
 
@@ -150,7 +149,7 @@
             } catch (RuntimeException e) {
                 throw e;
             } catch (Exception e) {
-                throw new SQLNestedException("Cannot set the pool on this factory", e);
+                throw (SQLException) new SQLException("Cannot set the pool on this factory").initCause(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=734481&r1=734480&r2=734481&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
Wed Jan 14 10:55:39 2009
@@ -32,7 +32,6 @@
 
 import org.apache.commons.pool.ObjectPool;
 import org.apache.commons.pool.impl.GenericObjectPool;
-import org.apache.commons.dbcp.SQLNestedException;
 
 /**
  * <p>
@@ -373,7 +372,7 @@
                 registerPool(username, password);
                 pool = pools.get(key);
             } catch (NamingException e) {
-                throw new SQLNestedException("RegisterPool failed", e);
+                throw (SQLException) new SQLException("RegisterPool failed").initCause(e);
             }
         }
 
@@ -382,8 +381,8 @@
             info = (PooledConnectionAndInfo)((ObjectPool) pool).borrowObject();
         }
         catch (Exception e) {
-            throw new SQLNestedException(
-                "Could not retrieve connection info from pool", e);
+            throw (SQLException) new SQLException(
+                "Could not retrieve connection info from pool").initCause(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=734481&r1=734480&r2=734481&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
Wed Jan 14 10:55:39 2009
@@ -31,7 +31,6 @@
 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
@@ -158,7 +157,7 @@
             try {
                 registerPool(username, password);
             } catch (NamingException e) {
-                throw new SQLNestedException("RegisterPool failed", e);
+                throw (SQLException) new SQLException("RegisterPool failed").initCause(e);
             }
         }
 
@@ -171,12 +170,12 @@
             if ((userKeys != null) && (userKeys.containsKey(username))) {
                 userKeys.remove(username);
             }
-            throw new SQLNestedException(
-                "Could not retrieve connection info from pool", ex);
+            throw (SQLException) new SQLException(
+                "Could not retrieve connection info from pool").initCause(ex);
         }
         catch (Exception e) {
-            throw new SQLNestedException(
-                "Could not retrieve connection info from pool", e);
+            throw (SQLException) new SQLException(
+                "Could not retrieve connection info from pool").initCause(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=734481&r1=734480&r2=734481&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
Wed Jan 14 10:55:39 2009
@@ -20,7 +20,6 @@
 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;
@@ -110,7 +109,7 @@
             String message = "Cannot load XA data source class '" + xaDataSource + "'";
             logWriter.println(message);
             t.printStackTrace(logWriter);
-            throw new SQLNestedException(message, t);
+            throw (SQLException) new SQLException(message).initCause(t);
         }
 
         // Create the xa data source instance
@@ -121,7 +120,7 @@
             String message = "Cannot create XA data source of class '" + xaDataSource + "'";
             logWriter.println(message);
             t.printStackTrace(logWriter);
-            throw new SQLNestedException(message, t);
+            throw (SQLException) new SQLException(message).initCause(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=734481&r1=734480&r2=734481&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 Wed Jan
14 10:55:39 2009
@@ -212,7 +212,7 @@
     
     protected void checkFailure() throws SQLException {
         if (failure != null) {
-            throw new SQLNestedException("TesterConnection failure", failure);
+            throw (SQLException) new SQLException("TesterConnection failure").initCause(failure);
         }
     }
     



Mime
View raw message