org.apache.commons.pool2.impl.GenericKeyedObjectPool.returnObject(K, T)
should throw IllegalStateException instead of NullPointerException when
a key is not found in the pool map.
Better message.
@@ -454,7 +454,7 @@ public class GenericKeyedObjectPool<K, T> extends BaseGenericObjectPool<T>
if (objectDeque == null) {
throw new IllegalStateException(
- "Returned object not currently part of this pool");
+ "No keyed pool found under the given key.");
}
final PooledObject<T> p = objectDeque.getAllObjects().get(new IdentityWrapper<>(obj));
