This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-dbcp.git
commit 4581b8d403a16306467c30607819397b73f68806 Author: Gary Gregory <[email protected]> AuthorDate: Sun Jul 10 15:44:46 2022 -0400 Simplify --- .../apache/commons/dbcp2/datasources/CPDSConnectionFactory.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/apache/commons/dbcp2/datasources/CPDSConnectionFactory.java b/src/main/java/org/apache/commons/dbcp2/datasources/CPDSConnectionFactory.java index 76ea6db6..9d04001c 100644 --- a/src/main/java/org/apache/commons/dbcp2/datasources/CPDSConnectionFactory.java +++ b/src/main/java/org/apache/commons/dbcp2/datasources/CPDSConnectionFactory.java @@ -305,7 +305,6 @@ final class CPDSConnectionFactory @Override public synchronized PooledObject<PooledConnectionAndInfo> makeObject() { - final PooledConnectionAndInfo pci; try { PooledConnection pc = null; if (userPassKey.getUserName() == null) { @@ -313,20 +312,18 @@ final class CPDSConnectionFactory } else { pc = cpds.getPooledConnection(userPassKey.getUserName(), userPassKey.getPassword()); } - if (pc == null) { throw new IllegalStateException("Connection pool data source returned null from getPooledConnection"); } - // should we add this object as a listener or the pool. // consider the validateObject method in decision pc.addConnectionEventListener(this); - pci = new PooledConnectionAndInfo(pc, userPassKey); + final PooledConnectionAndInfo pci = new PooledConnectionAndInfo(pc, userPassKey); pcMap.put(pc, pci); + return new DefaultPooledObject<>(pci); } catch (final SQLException e) { throw new RuntimeException(e.getMessage()); } - return new DefaultPooledObject<>(pci); } @Override
