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 2024/05/03 14:01:40 UTC

(commons-dbcp) branch master updated: Normalize exception message

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


The following commit(s) were added to refs/heads/master by this push:
     new 39bfef76 Normalize exception message
39bfef76 is described below

commit 39bfef760102b8fd1517c152c1da350873576fd9
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri May 3 10:01:35 2024 -0400

    Normalize exception message
---
 src/main/java/org/apache/commons/dbcp2/PoolingDataSource.java | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/commons/dbcp2/PoolingDataSource.java b/src/main/java/org/apache/commons/dbcp2/PoolingDataSource.java
index 36cf46d2..1f7c0aa0 100644
--- a/src/main/java/org/apache/commons/dbcp2/PoolingDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/PoolingDataSource.java
@@ -99,13 +99,12 @@ public class PoolingDataSource<C extends Connection> implements DataSource, Auto
      *            the given connection pool.
      */
     public PoolingDataSource(final ObjectPool<C> pool) {
-        Objects.requireNonNull(pool, "Pool must not be null.");
+        Objects.requireNonNull(pool, "pool");
         this.pool = pool;
         // Verify that pool's factory refers back to it. If not, log a warning and try to fix.
         if (this.pool instanceof GenericObjectPool<?>) {
-            final PoolableConnectionFactory pcf = (PoolableConnectionFactory) ((GenericObjectPool<?>) this.pool)
-                    .getFactory();
-            Objects.requireNonNull(pcf, "PoolableConnectionFactory must not be null.");
+            final PoolableConnectionFactory pcf = (PoolableConnectionFactory) ((GenericObjectPool<?>) this.pool).getFactory();
+            Objects.requireNonNull(pcf, "this.pool.getFactory()");
             if (pcf.getPool() != this.pool) {
                 log.warn(Utils.getMessage("poolingDataSource.factoryConfig"));
                 @SuppressWarnings("unchecked") // PCF must have a pool of PCs