commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pste...@apache.org
Subject svn commit: r616142 - in /commons/proper/dbcp/trunk: src/java/org/apache/commons/dbcp/datasources/SharedPoolDataSource.java src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java xdocs/changes.xml
Date Tue, 29 Jan 2008 02:29:01 GMT
Author: psteitz
Date: Mon Jan 28 18:29:00 2008
New Revision: 616142

URL: http://svn.apache.org/viewvc?rev=616142&view=rev
Log:
Fixed error in SharedPoolDataSource causing incorrect passwords to be 
stored under certain conditions.
JIRA: DBCP-245
Reported and patched by Michael Drechsel

Modified:
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/SharedPoolDataSource.java
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java
    commons/proper/dbcp/trunk/xdocs/changes.xml

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/SharedPoolDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/SharedPoolDataSource.java?rev=616142&r1=616141&r2=616142&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/SharedPoolDataSource.java
(original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/SharedPoolDataSource.java
Mon Jan 28 18:29:00 2008
@@ -167,6 +167,13 @@
             info = (PooledConnectionAndInfo) pool
                 .borrowObject(getUserPassKey(username, password));
         }
+        catch (SQLException ex) {  // Remove bad UserPassKey
+            if ((userKeys != null) && (userKeys.containsKey(username))) {
+                userKeys.remove(username);
+            }
+            throw new SQLNestedException(
+                "Could not retrieve connection info from pool", ex);
+        }
         catch (Exception e) {
             throw new SQLNestedException(
                 "Could not retrieve connection info from pool", e);

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java?rev=616142&r1=616141&r2=616142&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java
(original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java
Mon Jan 28 18:29:00 2008
@@ -78,9 +78,14 @@
      * Switching 'u1 -> 'u2' and 'p1' -> 'p2' will
      * exhibit the bug detailed in 
      * http://issues.apache.org/bugzilla/show_bug.cgi?id=18905
+     * 
+     * Starting with a successful connection, then incorrect password,
+     * then correct password for same user illustrates
+     * JIRA: DBCP-245
      */
     public void testIncorrectPassword() throws Exception 
     {
+        ds.getConnection("u2", "p2").close();
         try {
             // Use bad password
             ds.getConnection("u1", "zlsafjk").close();
@@ -520,6 +525,5 @@
         assertTrue(l3HashCode == l4HashCode);
         conn.close();
         conn = null;
-
     }
 }

Modified: commons/proper/dbcp/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/xdocs/changes.xml?rev=616142&r1=616141&r2=616142&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/xdocs/changes.xml (original)
+++ commons/proper/dbcp/trunk/xdocs/changes.xml Mon Jan 28 18:29:00 2008
@@ -101,6 +101,10 @@
         removeConnectionEventListener from connection event handlers to
         eliminate potential for ConcurrentModificationExceptions.
       </action>
+      <action dev="psteitz" type="fix" issue="DBCP-245" due-to="Michael Drechsel">
+        Fixed error in SharedPoolDataSource causing incorrect passwords to be 
+        stored under certain conditions.
+      </action>   
     </release>
     <release version="1.2.2" date="2007-04-04"
       description="This is a maintenance release containing bug fixes



Mime
View raw message