From 2ef84d03761b5860cb8c8f008a661f35b8811b62 Mon Sep 17 00:00:00 2001 From: markt Date: Wed, 12 May 2010 10:29:06 +0000 Subject: [PATCH] Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49224 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 --- .../java/org/apache/tomcat/jdbc/pool/PooledConnection.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PooledConnection.java b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PooledConnection.java index 9cfc23b61..6132936fe 100644 --- a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PooledConnection.java +++ b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PooledConnection.java @@ -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) { -- 2.11.0