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 e44b45ff Javadoc, format, better error message, related to POOL-407
e44b45ff is described below
commit e44b45ff2085508e25cbe3d20663514ba1865366
Author: Gary Gregory <[email protected]>
AuthorDate: Wed Jan 25 09:17:23 2023 -0500
Javadoc, format, better error message, related to POOL-407
---
.../org/apache/commons/pool2/BaseKeyedPooledObjectFactory.java | 4 ++--
.../java/org/apache/commons/pool2/BasePooledObjectFactory.java | 10 ++++------
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git
a/src/main/java/org/apache/commons/pool2/BaseKeyedPooledObjectFactory.java
b/src/main/java/org/apache/commons/pool2/BaseKeyedPooledObjectFactory.java
index 0c894101..ddd90eae 100644
--- a/src/main/java/org/apache/commons/pool2/BaseKeyedPooledObjectFactory.java
+++ b/src/main/java/org/apache/commons/pool2/BaseKeyedPooledObjectFactory.java
@@ -78,7 +78,7 @@ public abstract class BaseKeyedPooledObjectFactory<K, V, E
extends Exception> ex
@Override
public PooledObject<V> makeObject(final K key) throws E {
- return wrap(Objects.requireNonNull(create(key),
"BaseKeyedPooledObjectFactory.create(key)"));
+ return wrap(Objects.requireNonNull(create(key), () ->
String.format("BaseKeyedPooledObjectFactory(%s).create(key=%s)",
getClass().getName(), key)));
}
/**
@@ -114,7 +114,7 @@ public abstract class BaseKeyedPooledObjectFactory<K, V, E
extends Exception> ex
* Wraps the provided instance with an implementation of
* {@link PooledObject}.
*
- * @param value the instance to wrap
+ * @param value the instance to wrap, should not be null.
* @return The provided instance, wrapped by a {@link PooledObject}
* @throws E if there is a problem wrapping an instance,
* this will be propagated to the code requesting an object.
diff --git
a/src/main/java/org/apache/commons/pool2/BasePooledObjectFactory.java
b/src/main/java/org/apache/commons/pool2/BasePooledObjectFactory.java
index da8c456b..3e1dee9e 100644
--- a/src/main/java/org/apache/commons/pool2/BasePooledObjectFactory.java
+++ b/src/main/java/org/apache/commons/pool2/BasePooledObjectFactory.java
@@ -63,14 +63,13 @@ public abstract class BasePooledObjectFactory<T, E extends
Exception> extends Ba
* @param p ignored
*/
@Override
- public void destroyObject(final PooledObject<T> p)
- throws E {
+ public void destroyObject(final PooledObject<T> p) throws E {
// The default implementation is a no-op.
}
@Override
public PooledObject<T> makeObject() throws E {
- return wrap(Objects.requireNonNull(create(),
"BasePooledObjectFactory.create()"));
+ return wrap(Objects.requireNonNull(create(), () ->
String.format("BasePooledObjectFactory(%s).create()", getClass().getName())));
}
/**
@@ -79,8 +78,7 @@ public abstract class BasePooledObjectFactory<T, E extends
Exception> extends Ba
* @param p ignored
*/
@Override
- public void passivateObject(final PooledObject<T> p)
- throws E {
+ public void passivateObject(final PooledObject<T> p) throws E {
// The default implementation is a no-op.
}
@@ -100,7 +98,7 @@ public abstract class BasePooledObjectFactory<T, E extends
Exception> extends Ba
* Wraps the provided instance with an implementation of
* {@link PooledObject}.
*
- * @param obj the instance to wrap
+ * @param obj the instance to wrap, should not be null.
*
* @return The provided instance, wrapped by a {@link PooledObject}
*/