Skip to content

Commit 6af9e7d

Browse files
committed
Flip null test
1 parent 5e4a8d4 commit 6af9e7d

5 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ protected void activate() {
112112
*/
113113
protected void checkOpen() throws SQLException {
114114
if (closed) {
115-
if (null != connection) {
115+
if (connection != null) {
116116
String label;
117117
try {
118118
label = connection.toString();

src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ public void setMaxOpenPrepatedStatements(final int maxOpenPreparedStatements) {
779779
* the {@link ObjectPool} in which to pool those {@link Connection}s
780780
*/
781781
public synchronized void setPool(final ObjectPool<PoolableConnection> pool) {
782-
if (null != this.pool && pool != this.pool) {
782+
if (this.pool != null && pool != this.pool) {
783783
Utils.closeQuietly(this.pool);
784784
}
785785
this.pool = pool;

src/main/java/org/apache/commons/dbcp2/PoolingConnection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public void activateObject(final PStmtKey key, final PooledObject<DelegatingPrep
110110
@Override
111111
public synchronized void close() throws SQLException {
112112
try {
113-
if (null != stmtPool) {
113+
if (stmtPool != null) {
114114
final KeyedObjectPool<PStmtKey, DelegatingPreparedStatement> oldPool = stmtPool;
115115
stmtPool = null;
116116
try {

src/main/java/org/apache/commons/dbcp2/datasources/CPDSConnectionFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public void connectionClosed(final ConnectionEvent event) {
130130
@Override
131131
public void connectionErrorOccurred(final ConnectionEvent event) {
132132
final PooledConnection pc = (PooledConnection) event.getSource();
133-
if (null != event.getSQLException()) {
133+
if (event.getSQLException() != null) {
134134
System.err.println("CLOSING DOWN CONNECTION DUE TO INTERNAL ERROR (" + event.getSQLException() + ")");
135135
}
136136
pc.removeConnectionEventListener(this);

src/main/java/org/apache/commons/dbcp2/datasources/KeyedCPDSConnectionFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public void connectionClosed(final ConnectionEvent event) {
117117
@Override
118118
public void connectionErrorOccurred(final ConnectionEvent event) {
119119
final PooledConnection pc = (PooledConnection) event.getSource();
120-
if (null != event.getSQLException()) {
120+
if (event.getSQLException() != null) {
121121
System.err.println("CLOSING DOWN CONNECTION DUE TO INTERNAL ERROR (" + event.getSQLException() + ")");
122122
}
123123
pc.removeConnectionEventListener(this);

0 commit comments

Comments
 (0)