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 2023/01/17 19:01:41 UTC
[commons-pool] branch master updated: Null-guard in GenericObjectPool.use(T) like other call sites of GenericObjectPool.getPooledObject(T).
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 0a41307f Null-guard in GenericObjectPool.use(T) like other call sites of GenericObjectPool.getPooledObject(T).
0a41307f is described below
commit 0a41307f7a180ff8b90ca1be0de4fd4d0291dd1a
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jan 17 14:01:36 2023 -0500
Null-guard in GenericObjectPool.use(T) like other call sites of
GenericObjectPool.getPooledObject(T).
---
src/changes/changes.xml | 5 ++++-
src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java | 5 ++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 9a2168ef..b9dc3199 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -70,7 +70,10 @@ The <action> type attribute can be add,update,fix,remove.
Fail-fast on null input for DefaultPooledObjectInfo.DefaultPooledObjectInfo(PooledObject) with a NullPointerException.
</action>
<action dev="niallp" type="fix" due-to="Shichao Yuan, Phil Steitz, Niall Pemberton" issue="POOL-393">
- Improve BaseGenericObjectPool's JMX Register performance when creating many pools.
+ Improve BaseGenericObjectPool's JMX Register performance when creating many pools.
+ </action>
+ <action dev="ggregory" type="fix" due-to="RĂ©da Housni Alaoui, Gary Gregory">
+ Null-guard in GenericObjectPool.use(T) like other call sites of GenericObjectPool.getPooledObject(T).
</action>
<!-- ADD -->
<action dev="ggregory" type="add" due-to="Gary Gregory">
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 73c8ed96..5ce1ee57 100644
--- a/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
+++ b/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
@@ -1172,7 +1172,10 @@ public class GenericObjectPool<T, E extends Exception> extends BaseGenericObject
public void use(final T pooledObject) {
final AbandonedConfig abandonedCfg = this.abandonedConfig;
if (abandonedCfg != null && abandonedCfg.getUseUsageTracking()) {
- getPooledObject(pooledObject).use();
+ final PooledObject<T> po = getPooledObject(pooledObject);
+ if (po != null) {
+ po.use();
+ }
}
}