Skip to content

Commit 1979d4c

Browse files
committed
Flip null test
1 parent d22312c commit 1979d4c

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

doc/ReaderUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public String readToString(Reader in)
6060
// ignored
6161
}
6262
try {
63-
if (null != buf) {
63+
if (buf != null) {
6464
pool.returnObject(buf);
6565
}
6666
} catch (Exception e) {

src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ private void deregister(final K k) {
941941
// Pool may have changed since we released the read lock
942942
// numInterested decrement could lead to removal while waiting for write lock
943943
objectDeque = poolMap.get(k);
944-
if (null != objectDeque && objectDeque.getNumInterested().get() == 0 && objectDeque.getCreateCount().get() == 0) {
944+
if (objectDeque != null && objectDeque.getNumInterested().get() == 0 && objectDeque.getCreateCount().get() == 0) {
945945
// NOTE: Keys must always be removed from both poolMap and
946946
// poolKeyList at the same time while protected by
947947
// keyLock.writeLock()

src/main/java/org/apache/commons/pool2/impl/SoftReferenceObjectPool.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public synchronized T borrowObject() throws Exception {
199199
ref.getReference().clear();
200200
ref.setReference(new SoftReference<>(obj));
201201
}
202-
if (null != factory && null != obj) {
202+
if (factory != null && obj != null) {
203203
try {
204204
factory.activateObject(ref);
205205
if (!factory.validateObject(ref)) {
@@ -231,10 +231,10 @@ public synchronized T borrowObject() throws Exception {
231231
*/
232232
@Override
233233
public synchronized void clear() {
234-
if (null != factory) {
234+
if (factory != null) {
235235
idleReferences.forEach(ref -> {
236236
try {
237-
if (null != ref.getObject()) {
237+
if (ref.getObject() != null) {
238238
factory.destroyObject(ref);
239239
}
240240
} catch (final Exception ignored) {

0 commit comments

Comments
 (0)