You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2021/05/26 22:32:26 UTC

[commons-pool] branch master updated: Combine else if.

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-pool.git


The following commit(s) were added to refs/heads/master by this push:
     new 1077d2b  Combine else if.
1077d2b is described below

commit 1077d2b0df36a7d657ca1693677ad65e5c55cced
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed May 26 18:32:23 2021 -0400

    Combine else if.
---
 .../java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java  | 6 ++----
 src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java  | 6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java b/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
index ff42fd2..fce6d1c 100644
--- a/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
+++ b/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
@@ -451,10 +451,8 @@ public class GenericKeyedObjectPool<K, T> extends BaseGenericObjectPool<T>
                         throw new NoSuchElementException(
                                 "Timeout waiting for idle object");
                     }
-                } else {
-                    if (p == null) {
-                        throw new NoSuchElementException("Pool exhausted");
-                    }
+                } else if (p == null) {
+                    throw new NoSuchElementException("Pool exhausted");
                 }
                 if (!p.allocate()) {
                     p = null;
diff --git a/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java b/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
index 97d38a2..bf008a2 100644
--- a/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
+++ b/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
@@ -320,10 +320,8 @@ public class GenericObjectPool<T> extends BaseGenericObjectPool<T>
                 if (p == null) {
                     throw new NoSuchElementException("Timeout waiting for idle object");
                 }
-            } else {
-                if (p == null) {
-                    throw new NoSuchElementException("Pool exhausted");
-                }
+            } else if (p == null) {
+                throw new NoSuchElementException("Pool exhausted");
             }
             if (!p.allocate()) {
                 p = null;