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 2021/06/06 15:40:29 UTC

[commons-dbcp] branch master updated: Update PoolKey#toString() to avoid revealing a user name is here.

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 c90720c  Update PoolKey#toString() to avoid revealing a user name is here.
c90720c is described below

commit c90720c766be12960913f05c63c68adc267257b2
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 6 11:40:26 2021 -0400

    Update PoolKey#toString() to avoid revealing a user name is here.
    
    Javadoc.
---
 src/changes/changes.xml                                                | 3 +++
 .../org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java    | 2 +-
 src/main/java/org/apache/commons/dbcp2/datasources/PoolKey.java        | 2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 9285023..33f217e 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -138,6 +138,9 @@ The <action> type attribute can be add,update,fix,remove.
       <action issue="DBCP-576" dev="ggregory" type="fix" due-to="Arturo Bernal">
         Simplify and inline variables #99.
       </action>
+      <action dev="ggregory" type="fix" due-to="Gary Gregory">
+        Update PoolKey#toString() to avoid revealing a user name is here.
+      </action>
       <!-- UPDATES -->
       <action dev="ggregory" type="update" due-to="Dependabot">
         Bump mockito-core from 3.5.11 to 3.11.0 #66, #72, #77, #85, #91, #105, #110.
diff --git a/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java b/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java
index 1a64425..d56b2b0 100644
--- a/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java
@@ -922,7 +922,7 @@ public abstract class InstanceKeyDataSource implements DataSource, Referenceable
 
     /**
      * Attempts to retrieve a database connection using {@link #getPooledConnectionAndInfo(String, String)} with the
-     * provided user name and password. The password on the {@link PooledConnectionAndInfo} instance returned by
+     * provided user name and password. The password on the {@code PooledConnectionAndInfo} instance returned by
      * <code>getPooledConnectionAndInfo</code> is compared to the <code>password</code> parameter. If the comparison
      * fails, a database connection using the supplied user name and password is attempted. If the connection attempt
      * fails, an SQLException is thrown, indicating that the given password did not match the password used to create
diff --git a/src/main/java/org/apache/commons/dbcp2/datasources/PoolKey.java b/src/main/java/org/apache/commons/dbcp2/datasources/PoolKey.java
index 0dcaace..89f8c69 100644
--- a/src/main/java/org/apache/commons/dbcp2/datasources/PoolKey.java
+++ b/src/main/java/org/apache/commons/dbcp2/datasources/PoolKey.java
@@ -61,7 +61,7 @@ class PoolKey implements Serializable {
     public String toString() {
         final StringBuilder sb = new StringBuilder(50);
         sb.append("PoolKey(");
-        sb.append("UserName").append(", ").append(dataSourceName);
+        sb.append(dataSourceName);
         sb.append(')');
         return sb.toString();
     }