From 88c3013e3587ac0b2dc95a66195b995eedf4200f Mon Sep 17 00:00:00 2001 From: fhanik Date: Wed, 23 Dec 2009 17:12:10 +0000 Subject: [PATCH] Allow null usernames and passwords to be passed in, so that one can call DataSource.getConnection() git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@893577 13f79535-47bb-0310-9956-ffa450edef68 --- modules/jdbc-pool/build.properties.default | 2 +- .../java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/jdbc-pool/build.properties.default b/modules/jdbc-pool/build.properties.default index 2518c547e..a16f5ce70 100644 --- a/modules/jdbc-pool/build.properties.default +++ b/modules/jdbc-pool/build.properties.default @@ -28,7 +28,7 @@ version.major=1 version.minor=0 version.build=8 -version.patch=.1 +version.patch=.2 version.suffix= # ----- Default Base Path for Dependent Packages ----- diff --git a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java index 150b917f4..7de726af8 100644 --- a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java +++ b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java @@ -385,8 +385,12 @@ public class DataSourceFactory implements ObjectFactory { poolProperties.setDbProperties(new Properties()); } - poolProperties.getDbProperties().setProperty("user",poolProperties.getUsername()); - poolProperties.getDbProperties().setProperty("password",poolProperties.getPassword()); + if (poolProperties.getUsername()!=null) { + poolProperties.getDbProperties().setProperty("user",poolProperties.getUsername()); + } + if (poolProperties.getPassword()!=null) { + poolProperties.getDbProperties().setProperty("password",poolProperties.getPassword()); + } value = properties.getProperty(PROP_INITSQL); if (value != null) { -- 2.11.0