This is an automated email from the ASF dual-hosted git repository.
garydgregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-dbcp.git
The following commit(s) were added to refs/heads/master by this push:
new 6df8eba0 Flip null test
6df8eba0 is described below
commit 6df8eba054edb3e54d0003f90b9980cddfa54c51
Author: Gary Gregory <[email protected]>
AuthorDate: Sun Jul 5 09:50:43 2026 -0400
Flip null test
---
.../java/org/apache/commons/dbcp2/DataSourceConnectionFactory.java | 2 +-
src/main/java/org/apache/commons/dbcp2/DelegatingResultSet.java | 4 ++--
.../java/org/apache/commons/dbcp2/DriverManagerConnectionFactory.java | 2 +-
src/main/java/org/apache/commons/dbcp2/PoolingConnection.java | 4 ++--
src/main/java/org/apache/commons/dbcp2/PoolingDriver.java | 2 +-
.../org/apache/commons/dbcp2/cpdsadapter/PooledConnectionImpl.java | 2 +-
.../org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java | 2 +-
7 files changed, 9 insertions(+), 9 deletions(-)
diff --git
a/src/main/java/org/apache/commons/dbcp2/DataSourceConnectionFactory.java
b/src/main/java/org/apache/commons/dbcp2/DataSourceConnectionFactory.java
index e67af183..5393dd1e 100644
--- a/src/main/java/org/apache/commons/dbcp2/DataSourceConnectionFactory.java
+++ b/src/main/java/org/apache/commons/dbcp2/DataSourceConnectionFactory.java
@@ -79,7 +79,7 @@ public class DataSourceConnectionFactory implements
ConnectionFactory {
@Override
public Connection createConnection() throws SQLException {
- if (null == userName && null == userPassword) {
+ if (userName == null && userPassword == null) {
return dataSource.getConnection();
}
return dataSource.getConnection(userName,
Utils.toString(userPassword));
diff --git a/src/main/java/org/apache/commons/dbcp2/DelegatingResultSet.java
b/src/main/java/org/apache/commons/dbcp2/DelegatingResultSet.java
index 39d6aa36..e61525bc 100644
--- a/src/main/java/org/apache/commons/dbcp2/DelegatingResultSet.java
+++ b/src/main/java/org/apache/commons/dbcp2/DelegatingResultSet.java
@@ -64,7 +64,7 @@ public final class DelegatingResultSet extends AbandonedTrace
implements ResultS
* @return a new delegate.
*/
public static ResultSet wrapResultSet(final Connection connection, final
ResultSet resultSet) {
- if (null == resultSet) {
+ if (resultSet == null) {
return null;
}
return new DelegatingResultSet(connection, resultSet);
@@ -80,7 +80,7 @@ public final class DelegatingResultSet extends AbandonedTrace
implements ResultS
* @return a new delegate.
*/
public static ResultSet wrapResultSet(final Statement statement, final
ResultSet resultSet) {
- if (null == resultSet) {
+ if (resultSet == null) {
return null;
}
return new DelegatingResultSet(statement, resultSet);
diff --git
a/src/main/java/org/apache/commons/dbcp2/DriverManagerConnectionFactory.java
b/src/main/java/org/apache/commons/dbcp2/DriverManagerConnectionFactory.java
index b2fa894d..62d6400d 100644
--- a/src/main/java/org/apache/commons/dbcp2/DriverManagerConnectionFactory.java
+++ b/src/main/java/org/apache/commons/dbcp2/DriverManagerConnectionFactory.java
@@ -113,7 +113,7 @@ public class DriverManagerConnectionFactory implements
ConnectionFactory {
@Override
public Connection createConnection() throws SQLException {
- if (null == properties) {
+ if (properties == null) {
if (userName == null && userPassword == null) {
return DriverManager.getConnection(connectionUri);
}
diff --git a/src/main/java/org/apache/commons/dbcp2/PoolingConnection.java
b/src/main/java/org/apache/commons/dbcp2/PoolingConnection.java
index 13964de7..de15e4db 100644
--- a/src/main/java/org/apache/commons/dbcp2/PoolingConnection.java
+++ b/src/main/java/org/apache/commons/dbcp2/PoolingConnection.java
@@ -360,7 +360,7 @@ public class PoolingConnection extends
DelegatingConnection<Connection>
@SuppressWarnings("resource")
@Override
public PooledObject<DelegatingPreparedStatement> makeObject(final PStmtKey
key) throws SQLException {
- if (null == key) {
+ if (key == null) {
throw new IllegalArgumentException("Prepared statement key is null
or invalid.");
}
if (key.getStmtType() == StatementType.PREPARED_STATEMENT) {
@@ -480,7 +480,7 @@ public class PoolingConnection extends
DelegatingConnection<Connection>
* Wraps an underlying exception.
*/
private PreparedStatement prepareStatement(final PStmtKey key) throws
SQLException {
- if (null == stmtPool) {
+ if (stmtPool == null) {
throw new SQLException("Statement pool is null - closed or invalid
PoolingConnection.");
}
try {
diff --git a/src/main/java/org/apache/commons/dbcp2/PoolingDriver.java
b/src/main/java/org/apache/commons/dbcp2/PoolingDriver.java
index 204b1b12..323bc164 100644
--- a/src/main/java/org/apache/commons/dbcp2/PoolingDriver.java
+++ b/src/main/java/org/apache/commons/dbcp2/PoolingDriver.java
@@ -185,7 +185,7 @@ public class PoolingDriver implements Driver {
*/
public synchronized ObjectPool<? extends Connection>
getConnectionPool(final String name) throws SQLException {
final ObjectPool<? extends Connection> pool = pools.get(name);
- if (null == pool) {
+ if (pool == null) {
throw new SQLException("Pool not registered: " + name);
}
return pool;
diff --git
a/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PooledConnectionImpl.java
b/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PooledConnectionImpl.java
index 42433aa9..e7b9031d 100644
---
a/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PooledConnectionImpl.java
+++
b/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PooledConnectionImpl.java
@@ -422,7 +422,7 @@ final class PooledConnectionImpl
@SuppressWarnings("resource")
@Override
public PooledObject<DelegatingPreparedStatement> makeObject(final PStmtKey
key) throws SQLException {
- if (null == key) {
+ if (key == null) {
throw new IllegalArgumentException("Prepared statement key is null
or invalid.");
}
if (key.getStmtType() == StatementType.PREPARED_STATEMENT) {
diff --git
a/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java
b/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java
index 89cb14aa..217292af 100644
---
a/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java
+++
b/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java
@@ -251,7 +251,7 @@ public abstract class InstanceKeyDataSource implements
DataSource, Referenceable
}
// Password on PooledConnectionAndInfo does not match
- if (!(null == userPassword ? null == info.getPassword() :
userPassword.equals(info.getPassword()))) {
+ if (!(userPassword == null ? info.getPassword() == null :
userPassword.equals(info.getPassword()))) {
try { // See if password has changed by attempting connection
testCPDS(userName, userPassword);
} catch (final SQLException ex) {