Don't use deprecated API and better param name. Project: http://git-wip-us.apache.org/repos/asf/commons-dbcp/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-dbcp/commit/7908328f Tree: http://git-wip-us.apache.org/repos/asf/commons-dbcp/tree/7908328f Diff: http://git-wip-us.apache.org/repos/asf/commons-dbcp/diff/7908328f
Branch: refs/heads/release Commit: 7908328f012778568c6da95f7081b8c4b9754009 Parents: 0047005 Author: Gary Gregory <garydgreg...@gmail.com> Authored: Tue Jun 12 08:23:05 2018 -0600 Committer: Gary Gregory <garydgreg...@gmail.com> Committed: Tue Jun 12 08:23:05 2018 -0600 ---------------------------------------------------------------------- .../datasources/KeyedCPDSConnectionFactory.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/7908328f/src/main/java/org/apache/commons/dbcp2/datasources/KeyedCPDSConnectionFactory.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/dbcp2/datasources/KeyedCPDSConnectionFactory.java b/src/main/java/org/apache/commons/dbcp2/datasources/KeyedCPDSConnectionFactory.java index a755ebf..f802b8a 100644 --- a/src/main/java/org/apache/commons/dbcp2/datasources/KeyedCPDSConnectionFactory.java +++ b/src/main/java/org/apache/commons/dbcp2/datasources/KeyedCPDSConnectionFactory.java @@ -131,7 +131,7 @@ class KeyedCPDSConnectionFactory implements KeyedPooledObjectFactory<UserPassKey // should we add this object as a listener or the pool. // consider the validateObject method in decision pc.addConnectionEventListener(this); - pci = new PooledConnectionAndInfo(pc, userName, password); + pci = new PooledConnectionAndInfo(pc, userName, upkey.getPasswordCharArray()); pcMap.put(pc, pci); return new DefaultPooledObject<>(pci); @@ -153,29 +153,29 @@ class KeyedCPDSConnectionFactory implements KeyedPooledObjectFactory<UserPassKey * * @param key * ignored - * @param p + * @param pooledObject * wrapped {@link PooledConnectionAndInfo} containing the connection to validate * @return true if validation succeeds */ @Override - public boolean validateObject(final UserPassKey key, final PooledObject<PooledConnectionAndInfo> p) { + public boolean validateObject(final UserPassKey key, final PooledObject<PooledConnectionAndInfo> pooledObject) { try { - validateLifetime(p); + validateLifetime(pooledObject); } catch (final Exception e) { return false; } boolean valid = false; - final PooledConnection pconn = p.getObject().getPooledConnection(); + final PooledConnection pconn = pooledObject.getObject().getPooledConnection(); Connection conn = null; validatingSet.add(pconn); if (null == validationQuery) { - int timeout = validationQueryTimeoutSeconds; - if (timeout < 0) { - timeout = 0; + int timeoutSeconds = validationQueryTimeoutSeconds; + if (timeoutSeconds < 0) { + timeoutSeconds = 0; } try { conn = pconn.getConnection(); - valid = conn.isValid(timeout); + valid = conn.isValid(timeoutSeconds); } catch (final SQLException e) { valid = false; } finally {