Author: sebb
Date: Wed Jan 14 10:33:41 2009
New Revision: 734470

URL: http://svn.apache.org/viewvc?rev=734470&view=rev
Log:
Remove impossible null check
Replace deprecated SQLNestedException with equivalent code

Modified:
    
commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/BasicDataSource.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=734470&r1=734469&r2=734470&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:33:41 2009
@@ -1229,14 +1229,11 @@
                                               defaultTransactionIsolation,
                                               defaultCatalog,
                                               abandonedConfig);
-            if (connectionFactory == null) {
-                throw new SQLException("Cannot create 
PoolableConnectionFactory");
-            }
             validateConnectionFactory(connectionFactory);
         } catch (RuntimeException e) {
             throw e;
         } catch (Exception e) {
-            throw new SQLNestedException("Cannot create 
PoolableConnectionFactory (" + e.getMessage() + ")", e);
+            throw (SQLException) new SQLException("Cannot create 
PoolableConnectionFactory (" + e.getMessage() + ")").initCause(e);
         }
 
         // Create and return the pooling data source to manage the connections
@@ -1247,7 +1244,7 @@
                 connectionPool.addObject();
             }
         } catch (Exception e) {
-            throw new SQLNestedException("Error preloading the connection 
pool", e);
+            throw (SQLException) new SQLException("Error preloading the 
connection pool").initCause(e);
         }
         
         return dataSource;
@@ -1267,7 +1264,7 @@
                     driverClassName + "'";
                 logWriter.println(message);
                 t.printStackTrace(logWriter);
-                throw new SQLNestedException(message, t);
+                throw (SQLException) new SQLException(message).initCause(t);
             }
         }
 
@@ -1281,7 +1278,7 @@
                 "' for connect URL '" + url + "'";
             logWriter.println(message);
             t.printStackTrace(logWriter);
-            throw new SQLNestedException(message, t);
+            throw (SQLException) new SQLException(message).initCause(t);
         }
 
         // Can't test without a validationQuery


Reply via email to