commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1557575 - /commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolingDriver.java
Date Sun, 12 Jan 2014 18:01:52 GMT
Author: markt
Date: Sun Jan 12 18:01:52 2014
New Revision: 1557575

URL: http://svn.apache.org/r1557575
Log:
Reduce FindBugs warnings
Remove unnecessary null check

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

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolingDriver.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolingDriver.java?rev=1557575&r1=1557574&r2=1557575&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolingDriver.java (original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolingDriver.java Sun Jan
12 18:01:52 2014
@@ -123,24 +123,21 @@ public class PoolingDriver implements Dr
         if(acceptsURL(url)) {
             ObjectPool<? extends Connection> pool =
                 getConnectionPool(url.substring(URL_PREFIX_LEN));
-            if(null == pool) {
-                throw new SQLException("No pool found for " + url + ".");
-            } else {
-                try {
-                    Connection conn = pool.borrowObject();
-                    if (conn == null) {
-                        return null;
-                    }
-                    return new PoolGuardConnectionWrapper(pool, conn);
-                } catch(SQLException e) {
-                    throw e;
-                } catch(NoSuchElementException e) {
-                    throw (SQLException) new SQLException("Cannot get a connection, pool
error: " + e.getMessage()).initCause(e);
-                } catch(RuntimeException e) {
-                    throw e;
-                } catch(Exception e) {
-                    throw (SQLException) new SQLException("Cannot get a connection, general
error: " + e.getMessage()).initCause(e);
+
+            try {
+                Connection conn = pool.borrowObject();
+                if (conn == null) {
+                    return null;
                 }
+                return new PoolGuardConnectionWrapper(pool, conn);
+            } catch(SQLException e) {
+                throw e;
+            } catch(NoSuchElementException e) {
+                throw (SQLException) new SQLException("Cannot get a connection, pool error:
" + e.getMessage()).initCause(e);
+            } catch(RuntimeException e) {
+                throw e;
+            } catch(Exception e) {
+                throw (SQLException) new SQLException("Cannot get a connection, general error:
" + e.getMessage()).initCause(e);
             }
         } else {
             return null;



Mime
View raw message