This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
     new cbaa713f3f Align with Commons DBCP
cbaa713f3f is described below

commit cbaa713f3fa82667755cd67fa626a5b7bf07be93
Author: Mark Thomas <[email protected]>
AuthorDate: Tue Dec 16 17:20:59 2025 +0000

    Align with Commons DBCP
---
 .../apache/tomcat/dbcp/dbcp2/BasicDataSource.java  |   4 +-
 java/org/apache/tomcat/dbcp/dbcp2/Utils.java       |   2 +-
 .../dbcp2/cpdsadapter/PooledConnectionImpl.java    |  20 +--
 .../dbcp2/datasources/CPDSConnectionFactory.java   |   1 +
 .../datasources/KeyedCPDSConnectionFactory.java    |   2 +-
 .../dbcp/dbcp2/managed/ManagedConnection.java      |   1 -
 .../tomcat/dbcp/pool2/PooledObjectFactory.java     | 136 ++++++++++-----------
 .../dbcp/pool2/impl/BaseGenericObjectPool.java     |   1 -
 8 files changed, 83 insertions(+), 84 deletions(-)

diff --git a/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSource.java 
b/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSource.java
index 60ec36f4ad..10d2e0408f 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSource.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSource.java
@@ -69,7 +69,7 @@ public class BasicDataSource implements DataSource, 
BasicDataSourceMXBean, MBean
     private static final Log log = LogFactory.getLog(BasicDataSource.class);
 
     static {
-        // Attempt to prevent deadlocks - see DBCP - 272
+        // Attempt to prevent deadlocks - see DBCP-272
         DriverManager.getDrivers(); // NOPMD
     }
 
@@ -438,7 +438,7 @@ public class BasicDataSource implements DataSource, 
BasicDataSourceMXBean, MBean
      * with the specified {@link ClassLoader}.</li>
      * <li>If {code driverClassName} is specified and the previous attempt 
fails, the class is loaded using the
      * context class loader of the current thread.</li>
-     * <li>If a driver still isn't loaded one is loaded via the {@link 
DriverManager} using the specified {code connectionString}.
+     * <li>If a driver still isn't loaded one is loaded via the {@link 
DriverManager} using the specified {code connectionString}.</li>
      * </ol>
      * <p>
      * This method exists so subclasses can replace the implementation class.
diff --git a/java/org/apache/tomcat/dbcp/dbcp2/Utils.java 
b/java/org/apache/tomcat/dbcp/dbcp2/Utils.java
index 9fc58a11d9..976341708f 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/Utils.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/Utils.java
@@ -42,7 +42,7 @@ public final class Utils {
             .getBundle(Utils.class.getPackage().getName() + ".LocalStrings");
 
     /**
-     * Any SQL_STATE starting with this value is considered a fatal disconnect.
+     * Any SQL State starting with this value is considered a fatal disconnect.
      */
     public static final String DISCONNECTION_SQL_CODE_PREFIX = "08";
 
diff --git 
a/java/org/apache/tomcat/dbcp/dbcp2/cpdsadapter/PooledConnectionImpl.java 
b/java/org/apache/tomcat/dbcp/dbcp2/cpdsadapter/PooledConnectionImpl.java
index b98577aaec..4b97e83ed7 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/cpdsadapter/PooledConnectionImpl.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/cpdsadapter/PooledConnectionImpl.java
@@ -492,11 +492,11 @@ final class PooledConnectionImpl
      *            a {@link String} object that is the SQL statement to be sent 
to the database; may contain on or
      *            more '?' parameters.
      * @param resultSetType
-     *            a result set type; one of {@link 
ResultSet.TYPE_FORWARD_ONLY},
-     *            {@link ResultSet.TYPE_SCROLL_INSENSITIVE}, or {@link 
ResultSet.TYPE_SCROLL_SENSITIVE}.
+     *            a result set type; one of {@link 
ResultSet#TYPE_FORWARD_ONLY},
+     *            {@link ResultSet#TYPE_SCROLL_INSENSITIVE}, or {@link 
ResultSet#TYPE_SCROLL_SENSITIVE}.
      * @param resultSetConcurrency
-     *            a concurrency type; one of {@link 
ResultSet.CONCUR_READ_ONLY} or
-     *            {@link ResultSet.CONCUR_UPDATABLE}.
+     *            a concurrency type; one of {@link 
ResultSet#CONCUR_READ_ONLY} or
+     *            {@link ResultSet#CONCUR_UPDATABLE}.
      * @return a {@link CallableStatement} object containing the pre-compiled 
SQL statement that will produce
      *         {@link ResultSet} objects with the given type and concurrency.
      * @throws SQLException
@@ -526,14 +526,14 @@ final class PooledConnectionImpl
      *            a {@link String} object that is the SQL statement to be sent 
to the database; may contain on or
      *            more '?' parameters.
      * @param resultSetType
-     *            one of the following {@link ResultSet} constants: {@link 
ResultSet.TYPE_FORWARD_ONLY},
-     *            {@link ResultSet.TYPE_SCROLL_INSENSITIVE}, or {@link 
ResultSet.TYPE_SCROLL_SENSITIVE}.
+     *            one of the following {@link ResultSet} constants: {@link 
ResultSet#TYPE_FORWARD_ONLY},
+     *            {@link ResultSet#TYPE_SCROLL_INSENSITIVE}, or {@link 
ResultSet#TYPE_SCROLL_SENSITIVE}.
      * @param resultSetConcurrency
-     *            one of the following {@link ResultSet} constants: {@link 
ResultSet.CONCUR_READ_ONLY} or
-     *            {@link ResultSet.CONCUR_UPDATABLE}.
+     *            one of the following {@link ResultSet} constants: {@link 
ResultSet#CONCUR_READ_ONLY} or
+     *            {@link ResultSet#CONCUR_UPDATABLE}.
      * @param resultSetHoldability
-     *            one of the following {@link ResultSet} constants: {@link 
ResultSet.HOLD_CURSORS_OVER_COMMIT}
-     *            or {@link ResultSet.CLOSE_CURSORS_AT_COMMIT}.
+     *            one of the following {@link ResultSet} constants: {@link 
ResultSet#HOLD_CURSORS_OVER_COMMIT}
+     *            or {@link ResultSet#CLOSE_CURSORS_AT_COMMIT}.
      * @return a new {@link CallableStatement} object, containing the 
pre-compiled SQL statement, that will
      *         generate {@link ResultSet} objects with the given type, 
concurrency, and holdability.
      * @throws SQLException
diff --git 
a/java/org/apache/tomcat/dbcp/dbcp2/datasources/CPDSConnectionFactory.java 
b/java/org/apache/tomcat/dbcp/dbcp2/datasources/CPDSConnectionFactory.java
index 27f5a11e6b..ea98eb314d 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/datasources/CPDSConnectionFactory.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/datasources/CPDSConnectionFactory.java
@@ -66,6 +66,7 @@ final class CPDSConnectionFactory extends 
AbstractConnectionFactory
             final Duration validationQueryTimeoutDuration, final boolean 
rollbackAfterValidation, final String userName,
             final char[] userPassword) {
         super(cpds, validationQuery, validationQueryTimeoutDuration, 
rollbackAfterValidation);
+        this.userPassKey = new UserPassKey(userName, userPassword);
     }
 
     @Override
diff --git 
a/java/org/apache/tomcat/dbcp/dbcp2/datasources/KeyedCPDSConnectionFactory.java 
b/java/org/apache/tomcat/dbcp/dbcp2/datasources/KeyedCPDSConnectionFactory.java
index 8b465faae5..5c7a93335d 100644
--- 
a/java/org/apache/tomcat/dbcp/dbcp2/datasources/KeyedCPDSConnectionFactory.java
+++ 
b/java/org/apache/tomcat/dbcp/dbcp2/datasources/KeyedCPDSConnectionFactory.java
@@ -62,7 +62,7 @@ final class KeyedCPDSConnectionFactory extends 
AbstractConnectionFactory
     }
 
     @Override
-    public void activateObject(final UserPassKey key, final 
PooledObject<PooledConnectionAndInfo> pooledObject) throws SQLException {
+    public void activateObject(final UserPassKey ignored, final 
PooledObject<PooledConnectionAndInfo> pooledObject) throws SQLException {
         validateLifetime(pooledObject);
     }
 
diff --git a/java/org/apache/tomcat/dbcp/dbcp2/managed/ManagedConnection.java 
b/java/org/apache/tomcat/dbcp/dbcp2/managed/ManagedConnection.java
index 88f8e8eea1..b89225300b 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/managed/ManagedConnection.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/managed/ManagedConnection.java
@@ -232,7 +232,6 @@ public class ManagedConnection<C extends Connection> 
extends DelegatingConnectio
         if (isClosedInternal() && delegate != null) {
             try {
                 setDelegate(null);
-
                 if (!delegate.isClosed()) {
                     delegate.close();
                 }
diff --git a/java/org/apache/tomcat/dbcp/pool2/PooledObjectFactory.java 
b/java/org/apache/tomcat/dbcp/pool2/PooledObjectFactory.java
index c3e71b5acb..d28f0ff298 100644
--- a/java/org/apache/tomcat/dbcp/pool2/PooledObjectFactory.java
+++ b/java/org/apache/tomcat/dbcp/pool2/PooledObjectFactory.java
@@ -70,85 +70,85 @@ package org.apache.tomcat.dbcp.pool2;
  */
 public interface PooledObjectFactory<T> {
 
-  /**
-   * Reinitializes an instance to be returned by the pool.
-   *
-   * @param p a {@code PooledObject} wrapping the instance to be activated
-   * @throws Exception if there is a problem activating {@code obj},
-   *    this exception may be swallowed by the pool.
-   *
-   * @see #destroyObject
-   */
+    /**
+     * Reinitializes an instance to be returned by the pool.
+     *
+     * @param p a {@code PooledObject} wrapping the instance to be activated
+     * @throws Exception if there is a problem activating {@code obj},
+     *    this exception may be swallowed by the pool.
+     *
+     * @see #destroyObject
+     */
     void activateObject(PooledObject<T> p) throws Exception;
 
-  /**
-   * Destroys an instance no longer needed by the pool, using the default 
(NORMAL)
-   * DestroyMode.
-   * <p>
-   * It is important for implementations of this method to be aware that there
-   * is no guarantee about what state {@code obj} will be in and the
-   * implementation should be prepared to handle unexpected errors.
-   * </p>
-   * <p>
-   * Also, an implementation must take in to consideration that instances lost
-   * to the garbage collector may never be destroyed.
-   * </p>
-   *
-   * @param p a {@code PooledObject} wrapping the instance to be destroyed
-   * @throws Exception should be avoided as it may be swallowed by
-   *    the pool implementation.
-   *
-   * @see #validateObject
-   * @see ObjectPool#invalidateObject
-   */
+    /**
+     * Destroys an instance no longer needed by the pool, using the default 
(NORMAL)
+     * DestroyMode.
+     * <p>
+     * It is important for implementations of this method to be aware that 
there
+     * is no guarantee about what state {@code obj} will be in and the
+     * implementation should be prepared to handle unexpected errors.
+     * </p>
+     * <p>
+     * Also, an implementation must take in to consideration that instances 
lost
+     * to the garbage collector may never be destroyed.
+     * </p>
+     *
+     * @param p a {@code PooledObject} wrapping the instance to be destroyed
+     * @throws Exception should be avoided as it may be swallowed by
+     *    the pool implementation.
+     *
+     * @see #validateObject
+     * @see ObjectPool#invalidateObject
+     */
     void destroyObject(PooledObject<T> p) throws Exception;
 
-  /**
-   * Destroys an instance no longer needed by the pool, using the provided
-   * DestroyMode.
-   *
-   * @param p a {@code PooledObject} wrapping the instance to be destroyed
-   * @param destroyMode DestroyMode providing context to the factory
-   * @throws Exception should be avoided as it may be swallowed by
-   *    the pool implementation.
-   *
-   * @see #validateObject
-   * @see ObjectPool#invalidateObject
-   * @see #destroyObject(PooledObject)
-   * @see DestroyMode
-   * @since 2.9.0
-   */
+    /**
+     * Destroys an instance no longer needed by the pool, using the provided
+     * DestroyMode.
+     *
+     * @param p a {@code PooledObject} wrapping the instance to be destroyed
+     * @param destroyMode DestroyMode providing context to the factory
+     * @throws Exception should be avoided as it may be swallowed by
+     *    the pool implementation.
+     *
+     * @see #validateObject
+     * @see ObjectPool#invalidateObject
+     * @see #destroyObject(PooledObject)
+     * @see DestroyMode
+     * @since 2.9.0
+     */
     default void destroyObject(final PooledObject<T> p, final DestroyMode 
destroyMode) throws Exception {
         destroyObject(p);
     }
 
-  /**
-   * Creates an instance that can be served by the pool and wrap it in a
-   * {@link PooledObject} to be managed by the pool.
-   *
-   * @return a {@code PooledObject} wrapping an instance that can be served by 
the pool, not null.
-   * @throws Exception if there is a problem creating a new instance,
-   *    this will be propagated to the code requesting an object.
-   */
+    /**
+     * Creates an instance that can be served by the pool and wrap it in a
+     * {@link PooledObject} to be managed by the pool.
+     *
+     * @return a {@code PooledObject} wrapping an instance that can be served 
by the pool, not null.
+     * @throws Exception if there is a problem creating a new instance,
+     *    this will be propagated to the code requesting an object.
+     */
     PooledObject<T> makeObject() throws Exception;
 
-  /**
-   * Uninitializes an instance to be returned to the idle object pool.
-   *
-   * @param p a {@code PooledObject} wrapping the instance to be passivated
-   * @throws Exception if there is a problem passivating {@code obj},
-   *    this exception may be swallowed by the pool.
-   *
-   * @see #destroyObject
-   */
+    /**
+     * Uninitializes an instance to be returned to the idle object pool.
+     *
+     * @param p a {@code PooledObject} wrapping the instance to be passivated
+     * @throws Exception if there is a problem passivating {@code obj},
+     *    this exception may be swallowed by the pool.
+     *
+     * @see #destroyObject
+     */
     void passivateObject(PooledObject<T> p) throws Exception;
 
-  /**
-   * Ensures that the instance is safe to be returned by the pool.
-   *
-   * @param p a {@code PooledObject} wrapping the instance to be validated
-   * @return {@code false} if {@code obj} is not valid and should
-   *         be dropped from the pool, {@code true} otherwise.
-   */
+    /**
+     * Ensures that the instance is safe to be returned by the pool.
+     *
+     * @param p a {@code PooledObject} wrapping the instance to be validated
+     * @return {@code false} if {@code obj} is not valid and should
+     *         be dropped from the pool, {@code true} otherwise.
+     */
     boolean validateObject(PooledObject<T> p);
 }
diff --git a/java/org/apache/tomcat/dbcp/pool2/impl/BaseGenericObjectPool.java 
b/java/org/apache/tomcat/dbcp/pool2/impl/BaseGenericObjectPool.java
index 1c6ee31868..92e314dff3 100644
--- a/java/org/apache/tomcat/dbcp/pool2/impl/BaseGenericObjectPool.java
+++ b/java/org/apache/tomcat/dbcp/pool2/impl/BaseGenericObjectPool.java
@@ -1014,7 +1014,6 @@ public abstract class BaseGenericObjectPool<T> extends 
BaseObject implements Aut
      *         removal is configured for this pool; Integer.MAX_VALUE 
otherwise.
      *
      * @see AbandonedConfig#getRemoveAbandonedTimeoutDuration()
-     * @see AbandonedConfig#getRemoveAbandonedTimeoutDuration()
      * @deprecated Use {@link #getRemoveAbandonedTimeoutDuration()}.
      * @since 2.11.0
      */


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to