Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49224
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 12 May 2010 10:29:06 +0000 (10:29 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 12 May 2010 10:29:06 +0000 (10:29 +0000)
Only try setting the username and password if they are non-null
Patch provided by Matt Passell

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@943434 13f79535-47bb-0310-9956-ffa450edef68

modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PooledConnection.java

index 9cfc23b..6132936 100644 (file)
@@ -215,8 +215,13 @@ public class PooledConnection {
         String driverURL = poolProperties.getUrl();
         String usr = poolProperties.getUsername();
         String pwd = poolProperties.getPassword();
-        poolProperties.getDbProperties().setProperty("user", usr);
-        poolProperties.getDbProperties().setProperty("password", pwd);
+        if (usr != null) {
+            poolProperties.getDbProperties().setProperty("user", usr);
+        }
+        if (pwd != null) {
+            poolProperties.getDbProperties().setProperty("password", pwd);
+        }
+        
         try {
             connection = driver.connect(driverURL, poolProperties.getDbProperties());
         } catch (Exception x) {