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;