This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 7.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/7.0.x by this push: new c3b8200 Fix possible NPE c3b8200 is described below commit c3b8200f91563ef9f45837d8d9e5f2de3c4ca3c0 Author: Mark Thomas <ma...@apache.org> AuthorDate: Fri Mar 22 09:14:35 2019 +0000 Fix possible NPE --- .../tomcat/dbcp/dbcp/datasources/InstanceKeyDataSource.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/java/org/apache/tomcat/dbcp/dbcp/datasources/InstanceKeyDataSource.java b/java/org/apache/tomcat/dbcp/dbcp/datasources/InstanceKeyDataSource.java index 94dfe4e..6f5fdfb 100644 --- a/java/org/apache/tomcat/dbcp/dbcp/datasources/InstanceKeyDataSource.java +++ b/java/org/apache/tomcat/dbcp/dbcp/datasources/InstanceKeyDataSource.java @@ -726,8 +726,9 @@ public abstract class InstanceKeyDataSource throw new SQLException("Cannot borrow connection from pool", e); } + // Password on PooledConnectionAndInfo does not match if (!(null == password ? null == info.getPassword() - : password.equals(info.getPassword()))) { // Password on PooledConnectionAndInfo does not match + : password.equals(info.getPassword()))) { try { // See if password has changed by attempting connection testCPDS(username, password); } catch (SQLException ex) { @@ -736,8 +737,7 @@ public abstract class InstanceKeyDataSource throw new SQLException("Given password did not match password used" + " to create the PooledConnection."); } catch (javax.naming.NamingException ne) { - throw (SQLException) new SQLException( - "NamingException encountered connecting to database").initCause(ne); + throw new SQLException("NamingException encountered connecting to database", ne); } /* * Password must have changed -> destroy connection and keep retrying until we get a new, good one, @@ -764,7 +764,7 @@ public abstract class InstanceKeyDataSource closeDueToException(info); throw new SQLException("Cannot borrow connection from pool", e); } - if (info != null && password.equals(info.getPassword())) { + if (info != null && password != null && password.equals(info.getPassword())) { break; } else { if (info != null) { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org