Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/DelegatingStatement.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/DelegatingStatement.java?rev=1729274&r1=1729273&r2=1729274&view=diff ============================================================================== --- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/DelegatingStatement.java (original) +++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/DelegatingStatement.java Mon Feb 8 21:56:48 2016 @@ -143,10 +143,10 @@ public class DelegatingStatement extends // ResultSet's when it is closed. // FIXME The PreparedStatement we're wrapping should handle this for us. // See bug 17301 for what could happen when ResultSets are closed twice. - List<AbandonedTrace> resultSets = getTrace(); + final List<AbandonedTrace> resultSets = getTrace(); if( resultSets != null) { - ResultSet[] set = resultSets.toArray(new ResultSet[resultSets.size()]); - for (ResultSet element : set) { + final ResultSet[] set = resultSets.toArray(new ResultSet[resultSets.size()]); + for (final ResultSet element : set) { element.close(); } clearTrace(); @@ -156,7 +156,7 @@ public class DelegatingStatement extends _stmt.close(); } } - catch (SQLException e) { + catch (final SQLException e) { handleException(e); } } @@ -206,7 +206,7 @@ public class DelegatingStatement extends try { return DelegatingResultSet.wrapResultSet(this,_stmt.executeQuery(sql)); } - catch (SQLException e) { + catch (final SQLException e) { handleException(e); throw new AssertionError(); } @@ -218,7 +218,7 @@ public class DelegatingStatement extends try { return DelegatingResultSet.wrapResultSet(this,_stmt.getResultSet()); } - catch (SQLException e) { + catch (final SQLException e) { handleException(e); throw new AssertionError(); } @@ -232,54 +232,54 @@ public class DelegatingStatement extends } try { return _stmt.executeUpdate(sql); - } catch (SQLException e) { + } catch (final SQLException e) { handleException(e); return 0; } } @Override public int getMaxFieldSize() throws SQLException - { checkOpen(); try { return _stmt.getMaxFieldSize(); } catch (SQLException e) { handleException(e); return 0; } } + { checkOpen(); try { return _stmt.getMaxFieldSize(); } catch (final SQLException e) { handleException(e); return 0; } } @Override public void setMaxFieldSize(int max) throws SQLException - { checkOpen(); try { _stmt.setMaxFieldSize(max); } catch (SQLException e) { handleException(e); } } + { checkOpen(); try { _stmt.setMaxFieldSize(max); } catch (final SQLException e) { handleException(e); } } @Override public int getMaxRows() throws SQLException - { checkOpen(); try { return _stmt.getMaxRows(); } catch (SQLException e) { handleException(e); return 0; } } + { checkOpen(); try { return _stmt.getMaxRows(); } catch (final SQLException e) { handleException(e); return 0; } } @Override public void setMaxRows(int max) throws SQLException - { checkOpen(); try { _stmt.setMaxRows(max); } catch (SQLException e) { handleException(e); } } + { checkOpen(); try { _stmt.setMaxRows(max); } catch (final SQLException e) { handleException(e); } } @Override public void setEscapeProcessing(boolean enable) throws SQLException - { checkOpen(); try { _stmt.setEscapeProcessing(enable); } catch (SQLException e) { handleException(e); } } + { checkOpen(); try { _stmt.setEscapeProcessing(enable); } catch (final SQLException e) { handleException(e); } } @Override public int getQueryTimeout() throws SQLException - { checkOpen(); try { return _stmt.getQueryTimeout(); } catch (SQLException e) { handleException(e); return 0; } } + { checkOpen(); try { return _stmt.getQueryTimeout(); } catch (final SQLException e) { handleException(e); return 0; } } @Override public void setQueryTimeout(int seconds) throws SQLException - { checkOpen(); try { _stmt.setQueryTimeout(seconds); } catch (SQLException e) { handleException(e); } } + { checkOpen(); try { _stmt.setQueryTimeout(seconds); } catch (final SQLException e) { handleException(e); } } @Override public void cancel() throws SQLException - { checkOpen(); try { _stmt.cancel(); } catch (SQLException e) { handleException(e); } } + { checkOpen(); try { _stmt.cancel(); } catch (final SQLException e) { handleException(e); } } @Override public SQLWarning getWarnings() throws SQLException - { checkOpen(); try { return _stmt.getWarnings(); } catch (SQLException e) { handleException(e); throw new AssertionError(); } } + { checkOpen(); try { return _stmt.getWarnings(); } catch (final SQLException e) { handleException(e); throw new AssertionError(); } } @Override public void clearWarnings() throws SQLException - { checkOpen(); try { _stmt.clearWarnings(); } catch (SQLException e) { handleException(e); } } + { checkOpen(); try { _stmt.clearWarnings(); } catch (final SQLException e) { handleException(e); } } @Override public void setCursorName(String name) throws SQLException - { checkOpen(); try { _stmt.setCursorName(name); } catch (SQLException e) { handleException(e); } } + { checkOpen(); try { _stmt.setCursorName(name); } catch (final SQLException e) { handleException(e); } } @Override public boolean execute(String sql) throws SQLException { @@ -289,7 +289,7 @@ public class DelegatingStatement extends } try { return _stmt.execute(sql); - } catch (SQLException e) { + } catch (final SQLException e) { handleException(e); return false; } @@ -297,43 +297,43 @@ public class DelegatingStatement extends @Override public int getUpdateCount() throws SQLException - { checkOpen(); try { return _stmt.getUpdateCount(); } catch (SQLException e) { handleException(e); return 0; } } + { checkOpen(); try { return _stmt.getUpdateCount(); } catch (final SQLException e) { handleException(e); return 0; } } @Override public boolean getMoreResults() throws SQLException - { checkOpen(); try { return _stmt.getMoreResults(); } catch (SQLException e) { handleException(e); return false; } } + { checkOpen(); try { return _stmt.getMoreResults(); } catch (final SQLException e) { handleException(e); return false; } } @Override public void setFetchDirection(int direction) throws SQLException - { checkOpen(); try { _stmt.setFetchDirection(direction); } catch (SQLException e) { handleException(e); } } + { checkOpen(); try { _stmt.setFetchDirection(direction); } catch (final SQLException e) { handleException(e); } } @Override public int getFetchDirection() throws SQLException - { checkOpen(); try { return _stmt.getFetchDirection(); } catch (SQLException e) { handleException(e); return 0; } } + { checkOpen(); try { return _stmt.getFetchDirection(); } catch (final SQLException e) { handleException(e); return 0; } } @Override public void setFetchSize(int rows) throws SQLException - { checkOpen(); try { _stmt.setFetchSize(rows); } catch (SQLException e) { handleException(e); } } + { checkOpen(); try { _stmt.setFetchSize(rows); } catch (final SQLException e) { handleException(e); } } @Override public int getFetchSize() throws SQLException - { checkOpen(); try { return _stmt.getFetchSize(); } catch (SQLException e) { handleException(e); return 0; } } + { checkOpen(); try { return _stmt.getFetchSize(); } catch (final SQLException e) { handleException(e); return 0; } } @Override public int getResultSetConcurrency() throws SQLException - { checkOpen(); try { return _stmt.getResultSetConcurrency(); } catch (SQLException e) { handleException(e); return 0; } } + { checkOpen(); try { return _stmt.getResultSetConcurrency(); } catch (final SQLException e) { handleException(e); return 0; } } @Override public int getResultSetType() throws SQLException - { checkOpen(); try { return _stmt.getResultSetType(); } catch (SQLException e) { handleException(e); return 0; } } + { checkOpen(); try { return _stmt.getResultSetType(); } catch (final SQLException e) { handleException(e); return 0; } } @Override public void addBatch(String sql) throws SQLException - { checkOpen(); try { _stmt.addBatch(sql); } catch (SQLException e) { handleException(e); } } + { checkOpen(); try { _stmt.addBatch(sql); } catch (final SQLException e) { handleException(e); } } @Override public void clearBatch() throws SQLException - { checkOpen(); try { _stmt.clearBatch(); } catch (SQLException e) { handleException(e); } } + { checkOpen(); try { _stmt.clearBatch(); } catch (final SQLException e) { handleException(e); } } @Override public int[] executeBatch() throws SQLException { @@ -343,7 +343,7 @@ public class DelegatingStatement extends } try { return _stmt.executeBatch(); - } catch (SQLException e) { + } catch (final SQLException e) { handleException(e); throw new AssertionError(); } @@ -361,14 +361,14 @@ public class DelegatingStatement extends @Override public boolean getMoreResults(int current) throws SQLException - { checkOpen(); try { return _stmt.getMoreResults(current); } catch (SQLException e) { handleException(e); return false; } } + { checkOpen(); try { return _stmt.getMoreResults(current); } catch (final SQLException e) { handleException(e); return false; } } @Override public ResultSet getGeneratedKeys() throws SQLException { checkOpen(); try { return DelegatingResultSet.wrapResultSet(this, _stmt.getGeneratedKeys()); - } catch (SQLException e) { + } catch (final SQLException e) { handleException(e); throw new AssertionError(); } @@ -382,7 +382,7 @@ public class DelegatingStatement extends } try { return _stmt.executeUpdate(sql, autoGeneratedKeys); - } catch (SQLException e) { + } catch (final SQLException e) { handleException(e); return 0; } @@ -396,7 +396,7 @@ public class DelegatingStatement extends } try { return _stmt.executeUpdate(sql, columnIndexes); - } catch (SQLException e) { + } catch (final SQLException e) { handleException(e); return 0; } @@ -410,7 +410,7 @@ public class DelegatingStatement extends } try { return _stmt.executeUpdate(sql, columnNames); - } catch (SQLException e) { + } catch (final SQLException e) { handleException(e); return 0; } @@ -424,7 +424,7 @@ public class DelegatingStatement extends } try { return _stmt.execute(sql, autoGeneratedKeys); - } catch (SQLException e) { + } catch (final SQLException e) { handleException(e); return false; } @@ -438,7 +438,7 @@ public class DelegatingStatement extends } try { return _stmt.execute(sql, columnIndexes); - } catch (SQLException e) { + } catch (final SQLException e) { handleException(e); return false; } @@ -452,7 +452,7 @@ public class DelegatingStatement extends } try { return _stmt.execute(sql, columnNames); - } catch (SQLException e) { + } catch (final SQLException e) { handleException(e); return false; } @@ -460,7 +460,7 @@ public class DelegatingStatement extends @Override public int getResultSetHoldability() throws SQLException - { checkOpen(); try { return _stmt.getResultSetHoldability(); } catch (SQLException e) { handleException(e); return 0; } } + { checkOpen(); try { return _stmt.getResultSetHoldability(); } catch (final SQLException e) { handleException(e); return 0; } } /* * Note was protected prior to JDBC 4 @@ -499,7 +499,7 @@ public class DelegatingStatement extends try { _stmt.setPoolable(poolable); } - catch (SQLException e) { + catch (final SQLException e) { handleException(e); } } @@ -510,7 +510,7 @@ public class DelegatingStatement extends try { return _stmt.isPoolable(); } - catch (SQLException e) { + catch (final SQLException e) { handleException(e); return false; } @@ -521,7 +521,7 @@ public class DelegatingStatement extends checkOpen(); try { _stmt.closeOnCompletion(); - } catch (SQLException e) { + } catch (final SQLException e) { handleException(e); } } @@ -531,7 +531,7 @@ public class DelegatingStatement extends checkOpen(); try { return _stmt.isCloseOnCompletion(); - } catch (SQLException e) { + } catch (final SQLException e) { handleException(e); return false; }
Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PStmtKey.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PStmtKey.java?rev=1729274&r1=1729273&r2=1729274&view=diff ============================================================================== --- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PStmtKey.java (original) +++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PStmtKey.java Mon Feb 8 21:56:48 2016 @@ -118,7 +118,7 @@ public class PStmtKey { if (getClass() != obj.getClass()) { return false; } - PStmtKey other = (PStmtKey) obj; + final PStmtKey other = (PStmtKey) obj; if (_catalog == null) { if (other._catalog != null) { return false; @@ -175,7 +175,7 @@ public class PStmtKey { @Override public String toString() { - StringBuffer buf = new StringBuffer(); + final StringBuffer buf = new StringBuffer(); buf.append("PStmtKey: sql="); buf.append(_sql); buf.append(", catalog="); Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolableCallableStatement.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolableCallableStatement.java?rev=1729274&r1=1729273&r2=1729274&view=diff ============================================================================== --- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolableCallableStatement.java (original) +++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolableCallableStatement.java Mon Feb 8 21:56:48 2016 @@ -78,11 +78,11 @@ public class PoolableCallableStatement e if (!isClosed()) { try { _pool.returnObject(_key,this); - } catch(SQLException e) { + } catch(final SQLException e) { throw e; - } catch(RuntimeException e) { + } catch(final RuntimeException e) { throw e; - } catch(Exception e) { + } catch(final Exception e) { throw new SQLException("Cannot close CallableStatement (return to pool failed)", e); } } @@ -116,10 +116,10 @@ public class PoolableCallableStatement e // ResultSet's when it is closed. // FIXME The PreparedStatement we're wrapping should handle this for us. // See DBCP-10 for what could happen when ResultSets are closed twice. - List<AbandonedTrace> resultSets = getTrace(); + final List<AbandonedTrace> resultSets = getTrace(); if(resultSets != null) { - ResultSet[] set = resultSets.toArray(new ResultSet[resultSets.size()]); - for (ResultSet element : set) { + final ResultSet[] set = resultSets.toArray(new ResultSet[resultSets.size()]); + for (final ResultSet element : set) { element.close(); } clearTrace(); Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java?rev=1729274&r1=1729273&r2=1729274&view=diff ============================================================================== --- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java (original) +++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java Mon Feb 8 21:56:48 2016 @@ -168,14 +168,14 @@ public class PoolableConnection extends boolean isUnderlyingConectionClosed; try { isUnderlyingConectionClosed = getDelegateInternal().isClosed(); - } catch (SQLException e) { + } catch (final SQLException e) { try { _pool.invalidateObject(this); - } catch(IllegalStateException ise) { + } catch(final IllegalStateException ise) { // pool is closed, so close the connection passivate(); getInnermostDelegate().close(); - } catch (Exception ie) { + } catch (final Exception ie) { // DO NOTHING the original exception will be rethrown } throw new SQLException("Cannot close connection (isClosed check failed)", e); @@ -192,11 +192,11 @@ public class PoolableConnection extends // must destroy this proxy try { _pool.invalidateObject(this); - } catch(IllegalStateException e) { + } catch(final IllegalStateException e) { // pool is closed, so close the connection passivate(); getInnermostDelegate().close(); - } catch (Exception e) { + } catch (final Exception e) { throw new SQLException("Cannot close connection (invalidating pooled object failed)", e); } } else { @@ -204,15 +204,15 @@ public class PoolableConnection extends // simply need to return this proxy to the pool try { _pool.returnObject(this); - } catch(IllegalStateException e) { + } catch(final IllegalStateException e) { // pool is closed, so close the connection passivate(); getInnermostDelegate().close(); - } catch(SQLException e) { + } catch(final SQLException e) { throw e; - } catch(RuntimeException e) { + } catch(final RuntimeException e) { throw e; - } catch(Exception e) { + } catch(final Exception e) { throw new SQLException("Cannot close connection (return to pool failed)", e); } } @@ -235,7 +235,7 @@ public class PoolableConnection extends if (validationPreparedStatement != null) { try { validationPreparedStatement.close(); - } catch (SQLException sqle) { + } catch (final SQLException sqle) { // Ignore } } @@ -302,7 +302,7 @@ public class PoolableConnection extends if(!rs.next()) { throw new SQLException("validationQuery didn't return a row"); } - } catch (SQLException sqle) { + } catch (final SQLException sqle) { throw sqle; } } @@ -321,7 +321,7 @@ public class PoolableConnection extends */ private boolean isDisconnectionSqlException(SQLException e) { boolean fatalException = false; - String sqlState = e.getSQLState(); + final String sqlState = e.getSQLState(); if (sqlState != null) { fatalException = _disconnectionSqlCodes == null ? sqlState.startsWith(Utils.DISCONNECTION_SQL_CODE_PREFIX) || Utils.DISCONNECTION_SQL_CODES.contains(sqlState) : _disconnectionSqlCodes.contains(sqlState); Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java?rev=1729274&r1=1729273&r2=1729274&view=diff ============================================================================== --- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java (original) +++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java Mon Feb 8 21:56:48 2016 @@ -103,7 +103,7 @@ public class PoolableConnectionFactory if(null != _pool && pool != _pool) { try { _pool.close(); - } catch(Exception e) { + } catch(final Exception e) { // ignored !?! } } @@ -259,29 +259,29 @@ public class PoolableConnectionFactory } try { initializeConnection(conn); - } catch (SQLException sqle) { + } catch (final SQLException sqle) { // Make sure the connection is closed try { conn.close(); - } catch (SQLException ignore) { + } catch (final SQLException ignore) { // ignore } // Rethrow original exception so it is visible to caller throw sqle; } - long connIndex = connectionIndex.getAndIncrement(); + final long connIndex = connectionIndex.getAndIncrement(); if(poolStatements) { conn = new PoolingConnection(conn); - GenericKeyedObjectPoolConfig config = new GenericKeyedObjectPoolConfig(); + final GenericKeyedObjectPoolConfig config = new GenericKeyedObjectPoolConfig(); config.setMaxTotalPerKey(-1); config.setBlockWhenExhausted(false); config.setMaxWaitMillis(0); config.setMaxIdlePerKey(1); config.setMaxTotal(maxOpenPreparedStatements); if (dataSourceJmxName != null) { - StringBuilder base = new StringBuilder(dataSourceJmxName.toString()); + final StringBuilder base = new StringBuilder(dataSourceJmxName.toString()); base.append(Constants.JMX_CONNECTION_BASE_EXT); base.append(Long.toString(connIndex)); config.setJmxNameBase(base.toString()); @@ -289,7 +289,7 @@ public class PoolableConnectionFactory } else { config.setJmxEnabled(false); } - KeyedObjectPool<PStmtKey,DelegatingPreparedStatement> stmtPool = + final KeyedObjectPool<PStmtKey,DelegatingPreparedStatement> stmtPool = new GenericKeyedObjectPool<>((PoolingConnection)conn, config); ((PoolingConnection)conn).setStatementPool(stmtPool); ((PoolingConnection) conn).setCacheState(_cacheState); @@ -304,20 +304,20 @@ public class PoolableConnectionFactory Constants.JMX_CONNECTION_BASE_EXT + connIndex); } - PoolableConnection pc = new PoolableConnection(conn,_pool, connJmxName, + final PoolableConnection pc = new PoolableConnection(conn,_pool, connJmxName, _disconnectionSqlCodes, _fastFailValidation); return new DefaultPooledObject<>(pc); } protected void initializeConnection(Connection conn) throws SQLException { - Collection<String> sqls = _connectionInitSqls; + final Collection<String> sqls = _connectionInitSqls; if(conn.isClosed()) { throw new SQLException("initializeConnection: connection closed"); } if(null != sqls) { try (Statement stmt = conn.createStatement();) { - for (String sql : sqls) { + for (final String sql : sqls) { if (sql == null) { throw new NullPointerException( "null connectionInitSqls element"); @@ -341,7 +341,7 @@ public class PoolableConnectionFactory validateConnection(p.getObject()); return true; - } catch (Exception e) { + } catch (final Exception e) { if (log.isDebugEnabled()) { log.debug(Utils.getMessage( "poolableConnectionFactory.validateObject.fail"), e); @@ -363,7 +363,7 @@ public class PoolableConnectionFactory validateLifetime(p); - PoolableConnection conn = p.getObject(); + final PoolableConnection conn = p.getObject(); Boolean connAutoCommit = null; if (rollbackOnReturn) { connAutoCommit = Boolean.valueOf(conn.getAutoCommit()); @@ -394,7 +394,7 @@ public class PoolableConnectionFactory validateLifetime(p); - PoolableConnection conn = p.getObject(); + final PoolableConnection conn = p.getObject(); conn.activate(); if (_defaultAutoCommit != null && @@ -419,7 +419,7 @@ public class PoolableConnectionFactory private void validateLifetime(PooledObject<PoolableConnection> p) throws Exception { if (maxConnLifetimeMillis > 0) { - long lifetime = System.currentTimeMillis() - p.getCreateTime(); + final long lifetime = System.currentTimeMillis() - p.getCreateTime(); if (lifetime > maxConnLifetimeMillis) { throw new LifetimeExceededException(Utils.getMessage( "connectionFactory.lifetimeExceeded", Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolablePreparedStatement.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolablePreparedStatement.java?rev=1729274&r1=1729273&r2=1729274&view=diff ============================================================================== --- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolablePreparedStatement.java (original) +++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolablePreparedStatement.java Mon Feb 8 21:56:48 2016 @@ -101,11 +101,11 @@ public class PoolablePreparedStatement<K if (!isClosed()) { try { _pool.returnObject(_key, this); - } catch(SQLException e) { + } catch(final SQLException e) { throw e; - } catch(RuntimeException e) { + } catch(final RuntimeException e) { throw e; - } catch(Exception e) { + } catch(final Exception e) { throw new SQLException("Cannot close preparedstatement (return to pool failed)", e); } } @@ -136,10 +136,10 @@ public class PoolablePreparedStatement<K // ResultSet's when it is closed. // FIXME The PreparedStatement we're wrapping should handle this for us. // See bug 17301 for what could happen when ResultSets are closed twice. - List<AbandonedTrace> resultSets = getTrace(); + final List<AbandonedTrace> resultSets = getTrace(); if( resultSets != null) { - ResultSet[] set = resultSets.toArray(new ResultSet[resultSets.size()]); - for (ResultSet element : set) { + final ResultSet[] set = resultSets.toArray(new ResultSet[resultSets.size()]); + for (final ResultSet element : set) { element.close(); } clearTrace(); Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingConnection.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingConnection.java?rev=1729274&r1=1729273&r2=1729274&view=diff ============================================================================== --- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingConnection.java (original) +++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingConnection.java Mon Feb 8 21:56:48 2016 @@ -75,13 +75,13 @@ public class PoolingConnection extends D public synchronized void close() throws SQLException { try { if (null != _pstmtPool) { - KeyedObjectPool<PStmtKey,DelegatingPreparedStatement> oldpool = _pstmtPool; + final KeyedObjectPool<PStmtKey,DelegatingPreparedStatement> oldpool = _pstmtPool; _pstmtPool = null; try { oldpool.close(); - } catch(RuntimeException e) { + } catch(final RuntimeException e) { throw e; - } catch(Exception e) { + } catch(final Exception e) { throw new SQLException("Cannot close connection", e); } } @@ -107,11 +107,11 @@ public class PoolingConnection extends D } try { return _pstmtPool.borrowObject(createKey(sql)); - } catch(NoSuchElementException e) { + } catch(final NoSuchElementException e) { throw new SQLException("MaxOpenPreparedStatements limit reached", e); - } catch(RuntimeException e) { + } catch(final RuntimeException e) { throw e; - } catch(Exception e) { + } catch(final Exception e) { throw new SQLException("Borrow prepareStatement from pool failed", e); } } @@ -125,13 +125,13 @@ public class PoolingConnection extends D try { return _pstmtPool.borrowObject(createKey(sql, autoGeneratedKeys)); } - catch (NoSuchElementException e) { + catch (final NoSuchElementException e) { throw new SQLException("MaxOpenPreparedStatements limit reached", e); } - catch (RuntimeException e) { + catch (final RuntimeException e) { throw e; } - catch (Exception e) { + catch (final Exception e) { throw new SQLException("Borrow prepareStatement from pool failed", e); } } @@ -151,11 +151,11 @@ public class PoolingConnection extends D } try { return _pstmtPool.borrowObject(createKey(sql,resultSetType,resultSetConcurrency)); - } catch(NoSuchElementException e) { + } catch(final NoSuchElementException e) { throw new SQLException("MaxOpenPreparedStatements limit reached", e); - } catch(RuntimeException e) { + } catch(final RuntimeException e) { throw e; - } catch(Exception e) { + } catch(final Exception e) { throw new SQLException("Borrow prepareStatement from pool failed", e); } } @@ -170,11 +170,11 @@ public class PoolingConnection extends D public CallableStatement prepareCall(String sql) throws SQLException { try { return (CallableStatement) _pstmtPool.borrowObject(createKey(sql, StatementType.CALLABLE_STATEMENT)); - } catch (NoSuchElementException e) { + } catch (final NoSuchElementException e) { throw new SQLException("MaxOpenCallableStatements limit reached", e); - } catch (RuntimeException e) { + } catch (final RuntimeException e) { throw e; - } catch (Exception e) { + } catch (final Exception e) { throw new SQLException("Borrow callableStatement from pool failed", e); } } @@ -192,11 +192,11 @@ public class PoolingConnection extends D try { return (CallableStatement) _pstmtPool.borrowObject(createKey(sql, resultSetType, resultSetConcurrency, StatementType.CALLABLE_STATEMENT)); - } catch (NoSuchElementException e) { + } catch (final NoSuchElementException e) { throw new SQLException("MaxOpenCallableStatements limit reached", e); - } catch (RuntimeException e) { + } catch (final RuntimeException e) { throw e; - } catch (Exception e) { + } catch (final Exception e) { throw new SQLException("Borrow callableStatement from pool failed", e); } } @@ -226,7 +226,7 @@ public class PoolingConnection extends D String catalog = null; try { catalog = getCatalog(); - } catch (SQLException e) { + } catch (final SQLException e) { // Ignored } return new PStmtKey(normalizeSQL(sql), catalog, autoGeneratedKeys); @@ -242,7 +242,7 @@ public class PoolingConnection extends D String catalog = null; try { catalog = getCatalog(); - } catch (SQLException e) { + } catch (final SQLException e) { // Ignored } return new PStmtKey(normalizeSQL(sql), catalog, resultSetType, resultSetConcurrency); @@ -259,7 +259,7 @@ public class PoolingConnection extends D String catalog = null; try { catalog = getCatalog(); - } catch (SQLException e) { + } catch (final SQLException e) { // Ignored } return new PStmtKey(normalizeSQL(sql), catalog, resultSetType, resultSetConcurrency, stmtType); @@ -273,7 +273,7 @@ public class PoolingConnection extends D String catalog = null; try { catalog = getCatalog(); - } catch (SQLException e) { + } catch (final SQLException e) { // Ignored } return new PStmtKey(normalizeSQL(sql), catalog); @@ -288,7 +288,7 @@ public class PoolingConnection extends D String catalog = null; try { catalog = getCatalog(); - } catch (SQLException e) { + } catch (final SQLException e) { // Ignored } return new PStmtKey(normalizeSQL(sql), catalog, stmtType, null); @@ -320,6 +320,7 @@ public class PoolingConnection extends D if (null == key.getResultSetType() && null == key.getResultSetConcurrency() && null == key.getAutoGeneratedKeys()) { if (key.getStmtType() == StatementType.PREPARED_STATEMENT ) { @SuppressWarnings({"rawtypes", "unchecked"}) // Unable to find way to avoid this + final PoolablePreparedStatement pps = new PoolablePreparedStatement( getDelegate().prepareStatement(key.getSql()), key, _pstmtPool, this); return new DefaultPooledObject<DelegatingPreparedStatement>(pps); @@ -328,12 +329,14 @@ public class PoolingConnection extends D new PoolableCallableStatement(getDelegate().prepareCall( key.getSql()), key, _pstmtPool, this)); } else if (null == key.getResultSetType() && null == key.getResultSetConcurrency()){ @SuppressWarnings({"rawtypes", "unchecked"}) // Unable to find way to avoid this + final PoolablePreparedStatement pps = new PoolablePreparedStatement( getDelegate().prepareStatement(key.getSql(), key.getAutoGeneratedKeys().intValue()), key, _pstmtPool, this); return new DefaultPooledObject<DelegatingPreparedStatement>(pps); } else { // Both _resultSetType and _resultSetConcurrency are non-null here (both or neither are set by constructors) if(key.getStmtType() == StatementType.PREPARED_STATEMENT) { @SuppressWarnings({"rawtypes", "unchecked"}) // Unable to find way to avoid this + final PoolablePreparedStatement pps = new PoolablePreparedStatement(getDelegate().prepareStatement( key.getSql(), key.getResultSetType().intValue(),key.getResultSetConcurrency().intValue()), key, _pstmtPool, this); return new DefaultPooledObject<DelegatingPreparedStatement>(pps); @@ -397,7 +400,7 @@ public class PoolingConnection extends D @Override public void passivateObject(PStmtKey key, PooledObject<DelegatingPreparedStatement> p) throws Exception { - DelegatingPreparedStatement dps = p.getObject(); + final DelegatingPreparedStatement dps = p.getObject(); dps.clearParameters(); dps.passivate(); } Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingDataSource.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingDataSource.java?rev=1729274&r1=1729273&r2=1729274&view=diff ============================================================================== --- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingDataSource.java (original) +++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingDataSource.java Mon Feb 8 21:56:48 2016 @@ -57,13 +57,14 @@ public class PoolingDataSource<C extends _pool = pool; // Verify that _pool's factory refers back to it. If not, log a warning and try to fix. if (_pool instanceof GenericObjectPool<?>) { - PoolableConnectionFactory pcf = (PoolableConnectionFactory) ((GenericObjectPool<?>) _pool).getFactory(); + final PoolableConnectionFactory pcf = (PoolableConnectionFactory) ((GenericObjectPool<?>) _pool).getFactory(); if (pcf == null) { throw new NullPointerException("PoolableConnectionFactory must not be null."); } if (pcf.getPool() != _pool) { log.warn(Utils.getMessage("poolingDataSource.factoryConfig")); @SuppressWarnings("unchecked") // PCF must have a pool of PCs + final ObjectPool<PoolableConnection> p = (ObjectPool<PoolableConnection>) _pool; pcf.setPool(p); } @@ -78,9 +79,9 @@ public class PoolingDataSource<C extends public void close() throws Exception { try { _pool.close(); - } catch(RuntimeException rte) { + } catch(final RuntimeException rte) { throw new RuntimeException(Utils.getMessage("pool.close.fail"), rte); - } catch(Exception e) { + } catch(final Exception e) { throw new SQLException(Utils.getMessage("pool.close.fail"), e); } } @@ -131,18 +132,18 @@ public class PoolingDataSource<C extends @Override public Connection getConnection() throws SQLException { try { - C conn = _pool.borrowObject(); + final C conn = _pool.borrowObject(); if (conn == null) { return null; } return new PoolGuardConnectionWrapper<>(conn); - } catch(SQLException e) { + } catch(final SQLException e) { throw e; - } catch(NoSuchElementException e) { + } catch(final NoSuchElementException e) { throw new SQLException("Cannot get a connection, pool error " + e.getMessage(), e); - } catch(RuntimeException e) { + } catch(final RuntimeException e) { throw e; - } catch(Exception e) { + } catch(final Exception e) { throw new SQLException("Cannot get a connection, general error", e); } } Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingDriver.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingDriver.java?rev=1729274&r1=1729273&r2=1729274&view=diff ============================================================================== --- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingDriver.java (original) +++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingDriver.java Mon Feb 8 21:56:48 2016 @@ -46,7 +46,7 @@ public class PoolingDriver implements Dr static { try { DriverManager.registerDriver(new PoolingDriver()); - } catch(Exception e) { + } catch(final Exception e) { } } @@ -80,7 +80,7 @@ public class PoolingDriver implements Dr public synchronized ObjectPool<? extends Connection> getConnectionPool(String name) throws SQLException { - ObjectPool<? extends Connection> pool = pools.get(name); + final ObjectPool<? extends Connection> pool = pools.get(name); if (null == pool) { throw new SQLException("Pool not registered."); } @@ -93,20 +93,20 @@ public class PoolingDriver implements Dr } public synchronized void closePool(String name) throws SQLException { - ObjectPool<? extends Connection> pool = pools.get(name); + final ObjectPool<? extends Connection> pool = pools.get(name); if (pool != null) { pools.remove(name); try { pool.close(); } - catch (Exception e) { + catch (final Exception e) { throw new SQLException("Error closing pool " + name, e); } } } public synchronized String[] getPoolNames(){ - Set<String> names = pools.keySet(); + final Set<String> names = pools.keySet(); return names.toArray(new String[names.size()]); } @@ -114,7 +114,7 @@ public class PoolingDriver implements Dr public boolean acceptsURL(String url) throws SQLException { try { return url.startsWith(URL_PREFIX); - } catch(NullPointerException e) { + } catch(final NullPointerException e) { return false; } } @@ -122,22 +122,22 @@ public class PoolingDriver implements Dr @Override public Connection connect(String url, Properties info) throws SQLException { if(acceptsURL(url)) { - ObjectPool<? extends Connection> pool = + final ObjectPool<? extends Connection> pool = getConnectionPool(url.substring(URL_PREFIX_LEN)); try { - Connection conn = pool.borrowObject(); + final Connection conn = pool.borrowObject(); if (conn == null) { return null; } return new PoolGuardConnectionWrapper(pool, conn); - } catch(SQLException e) { + } catch(final SQLException e) { throw e; - } catch(NoSuchElementException e) { + } catch(final NoSuchElementException e) { throw new SQLException("Cannot get a connection, pool error: " + e.getMessage(), e); - } catch(RuntimeException e) { + } catch(final RuntimeException e) { throw e; - } catch(Exception e) { + } catch(final Exception e) { throw new SQLException("Cannot get a connection, general error: " + e.getMessage(), e); } } @@ -159,13 +159,14 @@ public class PoolingDriver implements Dr */ public void invalidateConnection(Connection conn) throws SQLException { if (conn instanceof PoolGuardConnectionWrapper) { // normal case - PoolGuardConnectionWrapper pgconn = (PoolGuardConnectionWrapper) conn; + final PoolGuardConnectionWrapper pgconn = (PoolGuardConnectionWrapper) conn; @SuppressWarnings("unchecked") + final ObjectPool<Connection> pool = (ObjectPool<Connection>) pgconn.pool; try { pool.invalidateObject(pgconn.getDelegateInternal()); } - catch (Exception e) { + catch (final Exception e) { } } else { Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/Utils.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/Utils.java?rev=1729274&r1=1729273&r2=1729274&view=diff ============================================================================== --- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/Utils.java (original) +++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/Utils.java Mon Feb 8 21:56:48 2016 @@ -78,7 +78,7 @@ public final class Utils { if (rset != null) { try { rset.close(); - } catch (Exception e) { + } catch (final Exception e) { // ignored } } @@ -93,7 +93,7 @@ public final class Utils { if (conn != null) { try { conn.close(); - } catch (Exception e) { + } catch (final Exception e) { // ignored } } @@ -108,7 +108,7 @@ public final class Utils { if (stmt != null) { try { stmt.close(); - } catch (Exception e) { + } catch (final Exception e) { // ignored } } @@ -128,11 +128,11 @@ public final class Utils { * replaced by the supplied arguments. */ public static String getMessage(String key, Object... args) { - String msg = messages.getString(key); + final String msg = messages.getString(key); if (args == null || args.length == 0) { return msg; } - MessageFormat mf = new MessageFormat(msg); + final MessageFormat mf = new MessageFormat(msg); return mf.format(args, new StringBuffer(), null).toString(); } } Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/ConnectionImpl.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/ConnectionImpl.java?rev=1729274&r1=1729273&r2=1729274&view=diff ============================================================================== --- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/ConnectionImpl.java (original) +++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/ConnectionImpl.java Mon Feb 8 21:56:48 2016 @@ -101,7 +101,7 @@ class ConnectionImpl extends DelegatingC return new DelegatingPreparedStatement (this, pooledConnection.prepareStatement(sql)); } - catch (SQLException e) { + catch (final SQLException e) { handleException(e); // Does not return return null; } @@ -125,7 +125,7 @@ class ConnectionImpl extends DelegatingC (this, pooledConnection.prepareStatement (sql,resultSetType,resultSetConcurrency)); } - catch (SQLException e) { + catch (final SQLException e) { handleException(e); return null; } @@ -142,7 +142,7 @@ class ConnectionImpl extends DelegatingC pooledConnection.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability)); } - catch (SQLException e) { + catch (final SQLException e) { handleException(e); return null; } @@ -156,7 +156,7 @@ class ConnectionImpl extends DelegatingC return new DelegatingPreparedStatement(this, pooledConnection.prepareStatement(sql, autoGeneratedKeys)); } - catch (SQLException e) { + catch (final SQLException e) { handleException(e); return null; } @@ -170,7 +170,7 @@ class ConnectionImpl extends DelegatingC return new DelegatingPreparedStatement(this, pooledConnection.prepareStatement(sql, columnIndexes)); } - catch (SQLException e) { + catch (final SQLException e) { handleException(e); return null; } @@ -184,7 +184,7 @@ class ConnectionImpl extends DelegatingC return new DelegatingPreparedStatement(this, pooledConnection.prepareStatement(sql, columnNames)); } - catch (SQLException e) { + catch (final SQLException e) { handleException(e); return null; } Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/DriverAdapterCPDS.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/DriverAdapterCPDS.java?rev=1729274&r1=1729273&r2=1729274&view=diff ============================================================================== --- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/DriverAdapterCPDS.java (original) +++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/DriverAdapterCPDS.java Mon Feb 8 21:56:48 2016 @@ -182,7 +182,7 @@ public class DriverAdapterCPDS } pci.setAccessToUnderlyingConnectionAllowed(isAccessToUnderlyingConnectionAllowed()); } - catch (ClassCircularityError e) + catch (final ClassCircularityError e) { if (connectionProperties != null) { pci = new PooledConnectionImpl(DriverManager.getConnection( @@ -195,7 +195,7 @@ public class DriverAdapterCPDS } KeyedObjectPool<PStmtKeyCPDS, PoolablePreparedStatement<PStmtKeyCPDS>> stmtPool = null; if (isPoolPreparedStatements()) { - GenericKeyedObjectPoolConfig config = new GenericKeyedObjectPoolConfig(); + final GenericKeyedObjectPoolConfig config = new GenericKeyedObjectPoolConfig(); config.setMaxTotalPerKey(Integer.MAX_VALUE); config.setBlockWhenExhausted(false); config.setMaxWaitMillis(0); @@ -238,9 +238,9 @@ public class DriverAdapterCPDS @Override public Reference getReference() throws NamingException { // this class implements its own factory - String factory = getClass().getName(); + final String factory = getClass().getName(); - Reference ref = new Reference(getClass().getName(), factory, null); + final Reference ref = new Reference(getClass().getName(), factory, null); ref.add(new StringRefAddr("description", getDescription())); ref.add(new StringRefAddr("driver", getDriver())); @@ -281,7 +281,7 @@ public class DriverAdapterCPDS // of the reference DriverAdapterCPDS cpds = null; if (refObj instanceof Reference) { - Reference ref = (Reference)refObj; + final Reference ref = (Reference)refObj; if (ref.getClassName().equals(getClass().getName())) { RefAddr ra = ref.get("description"); if (ra != null && ra.getContent() != null) { Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PStmtKeyCPDS.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PStmtKeyCPDS.java?rev=1729274&r1=1729273&r2=1729274&view=diff ============================================================================== --- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PStmtKeyCPDS.java (original) +++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PStmtKeyCPDS.java Mon Feb 8 21:56:48 2016 @@ -85,7 +85,7 @@ public class PStmtKeyCPDS extends PStmtK if (getClass() != obj.getClass()) { return false; } - PStmtKeyCPDS other = (PStmtKeyCPDS) obj; + final PStmtKeyCPDS other = (PStmtKeyCPDS) obj; if (!Arrays.equals(_columnIndexes, other._columnIndexes)) { return false; } @@ -116,7 +116,7 @@ public class PStmtKeyCPDS extends PStmtK @Override public String toString() { - StringBuffer buf = new StringBuffer(); + final StringBuffer buf = new StringBuffer(); buf.append("PStmtKey: sql="); buf.append(getSql()); buf.append(", catalog="); Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PooledConnectionImpl.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PooledConnectionImpl.java?rev=1729274&r1=1729273&r2=1729274&view=diff ============================================================================== --- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PooledConnectionImpl.java (original) +++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PooledConnectionImpl.java Mon Feb 8 21:56:48 2016 @@ -145,9 +145,9 @@ class PooledConnectionImpl pstmtPool = null; } } - } catch (RuntimeException e) { + } catch (final RuntimeException e) { throw e; - } catch (Exception e) { + } catch (final Exception e) { throw new SQLException("Cannot close connection (return to pool failed)", e); } finally { try { @@ -216,7 +216,7 @@ class PooledConnectionImpl // an error will occur. try { connection.close(); - } catch (Exception ignored) { + } catch (final Exception ignored) { } // make sure the last connection is marked as closed @@ -230,9 +230,9 @@ class PooledConnectionImpl * sends a connectionClosed event. */ void notifyListeners() { - ConnectionEvent event = new ConnectionEvent(this); - Object[] listeners = eventListeners.toArray(); - for (Object listener : listeners) { + final ConnectionEvent event = new ConnectionEvent(this); + final Object[] listeners = eventListeners.toArray(); + for (final Object listener : listeners) { ((ConnectionEventListener) listener).connectionClosed(event); } } @@ -251,9 +251,9 @@ class PooledConnectionImpl } try { return pstmtPool.borrowObject(createKey(sql)); - } catch (RuntimeException e) { + } catch (final RuntimeException e) { throw e; - } catch (Exception e) { + } catch (final Exception e) { throw new SQLException("Borrow prepareStatement from pool failed", e); } } @@ -283,9 +283,9 @@ class PooledConnectionImpl try { return pstmtPool.borrowObject( createKey(sql,resultSetType,resultSetConcurrency)); - } catch (RuntimeException e) { + } catch (final RuntimeException e) { throw e; - } catch (Exception e) { + } catch (final Exception e) { throw new SQLException("Borrow prepareStatement from pool failed", e); } } @@ -308,9 +308,9 @@ class PooledConnectionImpl } try { return pstmtPool.borrowObject(createKey(sql,autoGeneratedKeys)); - } catch (RuntimeException e) { + } catch (final RuntimeException e) { throw e; - } catch (Exception e) { + } catch (final Exception e) { throw new SQLException("Borrow prepareStatement from pool failed", e); } } @@ -325,9 +325,9 @@ class PooledConnectionImpl try { return pstmtPool.borrowObject(createKey(sql, resultSetType, resultSetConcurrency, resultSetHoldability)); - } catch (RuntimeException e) { + } catch (final RuntimeException e) { throw e; - } catch (Exception e) { + } catch (final Exception e) { throw new SQLException("Borrow prepareStatement from pool failed", e); } } @@ -339,9 +339,9 @@ class PooledConnectionImpl } try { return pstmtPool.borrowObject(createKey(sql, columnIndexes)); - } catch (RuntimeException e) { + } catch (final RuntimeException e) { throw e; - } catch (Exception e) { + } catch (final Exception e) { throw new SQLException("Borrow prepareStatement from pool failed", e); } } @@ -353,9 +353,9 @@ class PooledConnectionImpl } try { return pstmtPool.borrowObject(createKey(sql, columnNames)); - } catch (RuntimeException e) { + } catch (final RuntimeException e) { throw e; - } catch (Exception e) { + } catch (final Exception e) { throw new SQLException("Borrow prepareStatement from pool failed", e); } } @@ -493,7 +493,7 @@ class PooledConnectionImpl public void passivateObject(PStmtKeyCPDS key, PooledObject<PoolablePreparedStatement<PStmtKeyCPDS>> p) throws Exception { - PoolablePreparedStatement<PStmtKeyCPDS> ppss = p.getObject(); + final PoolablePreparedStatement<PStmtKeyCPDS> ppss = p.getObject(); ppss.clearParameters(); ppss.passivate(); } Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/CPDSConnectionFactory.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/CPDSConnectionFactory.java?rev=1729274&r1=1729273&r2=1729274&view=diff ============================================================================== --- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/CPDSConnectionFactory.java (original) +++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/CPDSConnectionFactory.java Mon Feb 8 21:56:48 2016 @@ -142,7 +142,7 @@ class CPDSConnectionFactory pc.addConnectionEventListener(this); pci = new PooledConnectionAndInfo(pc, _username, _password); pcMap.put(pc, pci); - } catch (SQLException e) { + } catch (final SQLException e) { throw new RuntimeException(e.getMessage()); } return new DefaultPooledObject<>(pci); @@ -157,7 +157,7 @@ class CPDSConnectionFactory } private void doDestroyObject(PooledConnectionAndInfo pci) throws Exception{ - PooledConnection pc = pci.getPooledConnection(); + final PooledConnection pc = pci.getPooledConnection(); pc.removeConnectionEventListener(this); pcMap.remove(pc); pc.close(); @@ -167,11 +167,11 @@ class CPDSConnectionFactory public boolean validateObject(PooledObject<PooledConnectionAndInfo> p) { try { validateLifetime(p); - } catch (Exception e) { + } catch (final Exception e) { return false; } boolean valid = false; - PooledConnection pconn = p.getObject().getPooledConnection(); + final PooledConnection pconn = p.getObject().getPooledConnection(); Connection conn = null; validatingSet.add(pconn); if (null == _validationQuery) { @@ -182,7 +182,7 @@ class CPDSConnectionFactory try { conn = pconn.getConnection(); valid = conn.isValid(timeout); - } catch (SQLException e) { + } catch (final SQLException e) { valid = false; } finally { Utils.closeQuietly(conn); @@ -208,7 +208,7 @@ class CPDSConnectionFactory if (_rollbackAfterValidation) { conn.rollback(); } - } catch (Exception e) { + } catch (final Exception e) { valid = false; } finally { Utils.closeQuietly(rset); @@ -244,24 +244,24 @@ class CPDSConnectionFactory */ @Override public void connectionClosed(ConnectionEvent event) { - PooledConnection pc = (PooledConnection) event.getSource(); + final PooledConnection pc = (PooledConnection) event.getSource(); // if this event occurred because we were validating, ignore it // otherwise return the connection to the pool. if (!validatingSet.contains(pc)) { - PooledConnectionAndInfo pci = pcMap.get(pc); + final PooledConnectionAndInfo pci = pcMap.get(pc); if (pci == null) { throw new IllegalStateException(NO_KEY_MESSAGE); } try { _pool.returnObject(pci); - } catch (Exception e) { + } catch (final Exception e) { System.err.println("CLOSING DOWN CONNECTION AS IT COULD " + "NOT BE RETURNED TO THE POOL"); pc.removeConnectionEventListener(this); try { doDestroyObject(pci); - } catch (Exception e2) { + } catch (final Exception e2) { System.err.println("EXCEPTION WHILE DESTROYING OBJECT " + pci); e2.printStackTrace(); @@ -276,7 +276,7 @@ class CPDSConnectionFactory */ @Override public void connectionErrorOccurred(ConnectionEvent event) { - PooledConnection pc = (PooledConnection)event.getSource(); + final PooledConnection pc = (PooledConnection)event.getSource(); if (null != event.getSQLException()) { System.err.println( "CLOSING DOWN CONNECTION DUE TO INTERNAL ERROR (" @@ -284,13 +284,13 @@ class CPDSConnectionFactory } pc.removeConnectionEventListener(this); - PooledConnectionAndInfo pci = pcMap.get(pc); + final PooledConnectionAndInfo pci = pcMap.get(pc); if (pci == null) { throw new IllegalStateException(NO_KEY_MESSAGE); } try { _pool.invalidateObject(pci); - } catch (Exception e) { + } catch (final Exception e) { System.err.println("EXCEPTION WHILE DESTROYING OBJECT " + pci); e.printStackTrace(); } @@ -308,14 +308,14 @@ class CPDSConnectionFactory */ @Override public void invalidate(PooledConnection pc) throws SQLException { - PooledConnectionAndInfo pci = pcMap.get(pc); + final PooledConnectionAndInfo pci = pcMap.get(pc); if (pci == null) { throw new IllegalStateException(NO_KEY_MESSAGE); } try { _pool.invalidateObject(pci); // Destroy instance and update pool counters _pool.close(); // Clear any other instances in this pool and kill others as they come back - } catch (Exception ex) { + } catch (final Exception ex) { throw new SQLException("Error invalidating connection", ex); } } @@ -354,7 +354,7 @@ class CPDSConnectionFactory } try { _pool.close(); - } catch (Exception ex) { + } catch (final Exception ex) { throw new SQLException("Error closing connection pool", ex); } } @@ -362,7 +362,7 @@ class CPDSConnectionFactory private void validateLifetime(PooledObject<PooledConnectionAndInfo> p) throws Exception { if (maxConnLifetimeMillis > 0) { - long lifetime = System.currentTimeMillis() - p.getCreateTime(); + final long lifetime = System.currentTimeMillis() - p.getCreateTime(); if (lifetime > maxConnLifetimeMillis) { throw new Exception(Utils.getMessage( "connectionFactory.lifetimeExceeded", Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java?rev=1729274&r1=1729273&r2=1729274&view=diff ============================================================================== --- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java (original) +++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java Mon Feb 8 21:56:48 2016 @@ -883,16 +883,16 @@ public abstract class InstanceKeyDataSou PooledConnectionAndInfo info = null; try { info = getPooledConnectionAndInfo(username, password); - } catch (NoSuchElementException e) { + } catch (final NoSuchElementException e) { closeDueToException(info); throw new SQLException("Cannot borrow connection from pool", e); - } catch (RuntimeException e) { + } catch (final RuntimeException e) { closeDueToException(info); throw e; - } catch (SQLException e) { + } catch (final SQLException e) { closeDueToException(info); throw e; - } catch (Exception e) { + } catch (final Exception e) { closeDueToException(info); throw new SQLException("Cannot borrow connection from pool", e); } @@ -901,12 +901,12 @@ public abstract class InstanceKeyDataSou : password.equals(info.getPassword()))) { // Password on PooledConnectionAndInfo does not match try { // See if password has changed by attempting connection testCPDS(username, password); - } catch (SQLException ex) { + } catch (final SQLException ex) { // Password has not changed, so refuse client, but return connection to the pool closeDueToException(info); throw new SQLException("Given password did not match password used" + " to create the PooledConnection.", ex); - } catch (javax.naming.NamingException ne) { + } catch (final javax.naming.NamingException ne) { throw new SQLException( "NamingException encountered connecting to database", ne); } @@ -922,16 +922,16 @@ public abstract class InstanceKeyDataSou for (int i = 0; i < 10; i++) { // Bound the number of retries - only needed if bad instances return try { info = getPooledConnectionAndInfo(username, password); - } catch (NoSuchElementException e) { + } catch (final NoSuchElementException e) { closeDueToException(info); throw new SQLException("Cannot borrow connection from pool", e); - } catch (RuntimeException e) { + } catch (final RuntimeException e) { closeDueToException(info); throw e; - } catch (SQLException e) { + } catch (final SQLException e) { closeDueToException(info); throw e; - } catch (Exception e) { + } catch (final Exception e) { closeDueToException(info); throw new SQLException("Cannot borrow connection from pool", e); } @@ -948,15 +948,15 @@ public abstract class InstanceKeyDataSou } } - Connection con = info.getPooledConnection().getConnection(); + final Connection con = info.getPooledConnection().getConnection(); try { setupDefaults(con, username); con.clearWarnings(); return con; - } catch (SQLException ex) { + } catch (final SQLException ex) { try { con.close(); - } catch (Exception exc) { + } catch (final Exception exc) { getLogWriter().println( "ignoring exception during close: " + exc); } @@ -976,7 +976,7 @@ public abstract class InstanceKeyDataSou if (info != null) { try { info.getPooledConnection().getConnection().close(); - } catch (Exception e) { + } catch (final Exception e) { // do not throw this exception because we are in the middle // of handling another exception. But record it because // it potentially leaks connections from the pool. @@ -998,7 +998,7 @@ public abstract class InstanceKeyDataSou } else { ctx = new InitialContext(jndiEnvironment); } - Object ds = ctx.lookup(dataSourceName); + final Object ds = ctx.lookup(dataSourceName); if (ds instanceof ConnectionPoolDataSource) { cpds = (ConnectionPoolDataSource) ds; } else { @@ -1028,7 +1028,7 @@ public abstract class InstanceKeyDataSou try { conn.close(); } - catch (SQLException e) { + catch (final SQLException e) { // at least we could connect } } Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSourceFactory.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSourceFactory.java?rev=1729274&r1=1729273&r2=1729274&view=diff ============================================================================== --- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSourceFactory.java (original) +++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSourceFactory.java Mon Feb 8 21:56:48 2016 @@ -47,18 +47,18 @@ abstract class InstanceKeyDataSourceFact static synchronized String registerNewInstance(InstanceKeyDataSource ds) { int max = 0; - Iterator<String> i = instanceMap.keySet().iterator(); + final Iterator<String> i = instanceMap.keySet().iterator(); while (i.hasNext()) { - String s = i.next(); + final String s = i.next(); if (s != null) { try { max = Math.max(max, Integer.parseInt(s)); - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { // no sweat, ignore those keys } } } - String instanceKey = String.valueOf(max + 1); + final String instanceKey = String.valueOf(max + 1); // put a placeholder here for now, so other instances will not // take our key. we will replace with a pool when ready. instanceMap.put(instanceKey, ds); @@ -76,7 +76,7 @@ abstract class InstanceKeyDataSourceFact */ public static void closeAll() throws Exception { //Get iterator to loop over all instances of this datasource. - Iterator<Entry<String,InstanceKeyDataSource>> instanceIterator = + final Iterator<Entry<String,InstanceKeyDataSource>> instanceIterator = instanceMap.entrySet().iterator(); while (instanceIterator.hasNext()) { instanceIterator.next().getValue().close(); @@ -97,9 +97,9 @@ abstract class InstanceKeyDataSourceFact // of the reference Object obj = null; if (refObj instanceof Reference) { - Reference ref = (Reference) refObj; + final Reference ref = (Reference) refObj; if (isCorrectClass(ref.getClassName())) { - RefAddr ra = ref.get("instanceKey"); + final RefAddr ra = ref.get("instanceKey"); if (ra != null && ra.getContent() != null) { // object was bound to jndi via Referenceable api. obj = instanceMap.get(ra.getContent()); @@ -117,7 +117,7 @@ abstract class InstanceKeyDataSourceFact } if (obj == null) { - InstanceKeyDataSource ds = getNewInstance(ref); + final InstanceKeyDataSource ds = getNewInstance(ref); setCommonProperties(ref, ds); obj = ds; if (key != null) @@ -147,7 +147,7 @@ abstract class InstanceKeyDataSourceFact ra = ref.get("jndiEnvironment"); if (ra != null && ra.getContent() != null) { - byte[] serialized = (byte[]) ra.getContent(); + final byte[] serialized = (byte[]) ra.getContent(); ikds.setJndiEnvironment((Properties) deserialize(serialized)); } @@ -321,7 +321,7 @@ abstract class InstanceKeyDataSourceFact if (in != null) { try { in.close(); - } catch (IOException ex) { + } catch (final IOException ex) { } } } Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/KeyedCPDSConnectionFactory.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/KeyedCPDSConnectionFactory.java?rev=1729274&r1=1729273&r2=1729274&view=diff ============================================================================== --- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/KeyedCPDSConnectionFactory.java (original) +++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/KeyedCPDSConnectionFactory.java Mon Feb 8 21:56:48 2016 @@ -123,8 +123,8 @@ class KeyedCPDSConnectionFactory PooledConnectionAndInfo pci = null; PooledConnection pc = null; - String username = upkey.getUsername(); - String password = upkey.getPassword(); + final String username = upkey.getUsername(); + final String password = upkey.getPassword(); if (username == null) { pc = _cpds.getPooledConnection(); } else { @@ -150,7 +150,7 @@ class KeyedCPDSConnectionFactory @Override public void destroyObject(UserPassKey key, PooledObject<PooledConnectionAndInfo> p) throws Exception { - PooledConnection pc = p.getObject().getPooledConnection(); + final PooledConnection pc = p.getObject().getPooledConnection(); pc.removeConnectionEventListener(this); pcMap.remove(pc); pc.close(); @@ -169,11 +169,11 @@ class KeyedCPDSConnectionFactory PooledObject<PooledConnectionAndInfo> p) { try { validateLifetime(p); - } catch (Exception e) { + } catch (final Exception e) { return false; } boolean valid = false; - PooledConnection pconn = p.getObject().getPooledConnection(); + final PooledConnection pconn = p.getObject().getPooledConnection(); Connection conn = null; validatingSet.add(pconn); if (null == _validationQuery) { @@ -184,7 +184,7 @@ class KeyedCPDSConnectionFactory try { conn = pconn.getConnection(); valid = conn.isValid(timeout); - } catch (SQLException e) { + } catch (final SQLException e) { valid = false; } finally { Utils.closeQuietly(conn); @@ -210,7 +210,7 @@ class KeyedCPDSConnectionFactory if (_rollbackAfterValidation) { conn.rollback(); } - } catch(Exception e) { + } catch(final Exception e) { valid = false; } finally { Utils.closeQuietly(rset); @@ -246,24 +246,24 @@ class KeyedCPDSConnectionFactory */ @Override public void connectionClosed(ConnectionEvent event) { - PooledConnection pc = (PooledConnection)event.getSource(); + final PooledConnection pc = (PooledConnection)event.getSource(); // if this event occurred because we were validating, or if this // connection has been marked for removal, ignore it // otherwise return the connection to the pool. if (!validatingSet.contains(pc)) { - PooledConnectionAndInfo pci = pcMap.get(pc); + final PooledConnectionAndInfo pci = pcMap.get(pc); if (pci == null) { throw new IllegalStateException(NO_KEY_MESSAGE); } try { _pool.returnObject(pci.getUserPassKey(), pci); - } catch (Exception e) { + } catch (final Exception e) { System.err.println("CLOSING DOWN CONNECTION AS IT COULD " + "NOT BE RETURNED TO THE POOL"); pc.removeConnectionEventListener(this); try { _pool.invalidateObject(pci.getUserPassKey(), pci); - } catch (Exception e3) { + } catch (final Exception e3) { System.err.println("EXCEPTION WHILE DESTROYING OBJECT " + pci); e3.printStackTrace(); @@ -278,7 +278,7 @@ class KeyedCPDSConnectionFactory */ @Override public void connectionErrorOccurred(ConnectionEvent event) { - PooledConnection pc = (PooledConnection)event.getSource(); + final PooledConnection pc = (PooledConnection)event.getSource(); if (null != event.getSQLException()) { System.err .println("CLOSING DOWN CONNECTION DUE TO INTERNAL ERROR (" + @@ -286,13 +286,13 @@ class KeyedCPDSConnectionFactory } pc.removeConnectionEventListener(this); - PooledConnectionAndInfo info = pcMap.get(pc); + final PooledConnectionAndInfo info = pcMap.get(pc); if (info == null) { throw new IllegalStateException(NO_KEY_MESSAGE); } try { _pool.invalidateObject(info.getUserPassKey(), info); - } catch (Exception e) { + } catch (final Exception e) { System.err.println("EXCEPTION WHILE DESTROYING OBJECT " + info); e.printStackTrace(); } @@ -311,15 +311,15 @@ class KeyedCPDSConnectionFactory */ @Override public void invalidate(PooledConnection pc) throws SQLException { - PooledConnectionAndInfo info = pcMap.get(pc); + final PooledConnectionAndInfo info = pcMap.get(pc); if (info == null) { throw new IllegalStateException(NO_KEY_MESSAGE); } - UserPassKey key = info.getUserPassKey(); + final UserPassKey key = info.getUserPassKey(); try { _pool.invalidateObject(key, info); // Destroy and update pool counters _pool.clear(key); // Remove any idle instances with this key - } catch (Exception ex) { + } catch (final Exception ex) { throw new SQLException("Error invalidating connection", ex); } } @@ -351,7 +351,7 @@ class KeyedCPDSConnectionFactory public void closePool(String username) throws SQLException { try { _pool.clear(new UserPassKey(username, null)); - } catch (Exception ex) { + } catch (final Exception ex) { throw new SQLException("Error closing connection pool", ex); } } @@ -359,7 +359,7 @@ class KeyedCPDSConnectionFactory private void validateLifetime(PooledObject<PooledConnectionAndInfo> p) throws Exception { if (maxConnLifetimeMillis > 0) { - long lifetime = System.currentTimeMillis() - p.getCreateTime(); + final long lifetime = System.currentTimeMillis() - p.getCreateTime(); if (lifetime > maxConnLifetimeMillis) { throw new Exception(Utils.getMessage( "connectionFactory.lifetimeExceeded", Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSource.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSource.java?rev=1729274&r1=1729273&r2=1729274&view=diff ============================================================================== --- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSource.java (original) +++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSource.java Mon Feb 8 21:56:48 2016 @@ -103,10 +103,10 @@ public class PerUserPoolDataSource exten */ @Override public void close() { - for (PooledConnectionManager manager : managers.values()) { + for (final PooledConnectionManager manager : managers.values()) { try { ((CPDSConnectionFactory) manager).getPool().close(); - } catch (Exception closePoolException) { + } catch (final Exception closePoolException) { //ignore and try to close others. } } @@ -854,7 +854,7 @@ public class PerUserPoolDataSource exten * Get the number of active connections in the pool for a given user. */ public int getNumActive(String username) { - ObjectPool<PooledConnectionAndInfo> pool = + final ObjectPool<PooledConnectionAndInfo> pool = getPool(getPoolKey(username)); return pool == null ? 0 : pool.getNumActive(); } @@ -870,7 +870,7 @@ public class PerUserPoolDataSource exten * Get the number of idle connections in the pool for a given user. */ public int getNumIdle(String username) { - ObjectPool<PooledConnectionAndInfo> pool = + final ObjectPool<PooledConnectionAndInfo> pool = getPool(getPoolKey(username)); return pool == null ? 0 : pool.getNumIdle(); } @@ -893,7 +893,7 @@ public class PerUserPoolDataSource exten try { registerPool(username, password); manager = managers.get(key); - } catch (NamingException e) { + } catch (final NamingException e) { throw new SQLException("RegisterPool failed", e); } } @@ -904,15 +904,15 @@ public class PerUserPoolDataSource exten try { info = pool.borrowObject(); } - catch (NoSuchElementException ex) { + catch (final NoSuchElementException ex) { throw new SQLException( "Could not retrieve connection info from pool", ex); } - catch (Exception e) { + catch (final Exception e) { // See if failure is due to CPDSConnectionFactory authentication failure try { testCPDS(username, password); - } catch (Exception ex) { + } catch (final Exception ex) { throw new SQLException( "Could not retrieve connection info from pool", ex); } @@ -924,12 +924,12 @@ public class PerUserPoolDataSource exten try { registerPool(username, password); pool = getPool(key); - } catch (NamingException ne) { + } catch (final NamingException ne) { throw new SQLException("RegisterPool failed", ne); } try { info = pool.borrowObject(); - } catch (Exception ex) { + } catch (final Exception ex) { throw new SQLException( "Could not retrieve connection info from pool", ex); } @@ -942,7 +942,7 @@ public class PerUserPoolDataSource exten throws SQLException { Boolean defaultAutoCommit = isDefaultAutoCommit(); if (username != null) { - Boolean userMax = getPerUserDefaultAutoCommit(username); + final Boolean userMax = getPerUserDefaultAutoCommit(username); if (userMax != null) { defaultAutoCommit = userMax; } @@ -950,7 +950,7 @@ public class PerUserPoolDataSource exten Boolean defaultReadOnly = isDefaultReadOnly(); if (username != null) { - Boolean userMax = getPerUserDefaultReadOnly(username); + final Boolean userMax = getPerUserDefaultReadOnly(username); if (userMax != null) { defaultReadOnly = userMax; } @@ -958,7 +958,7 @@ public class PerUserPoolDataSource exten int defaultTransactionIsolation = getDefaultTransactionIsolation(); if (username != null) { - Integer userMax = getPerUserDefaultTransactionIsolation(username); + final Integer userMax = getPerUserDefaultTransactionIsolation(username); if (userMax != null) { defaultTransactionIsolation = userMax.intValue(); } @@ -989,7 +989,7 @@ public class PerUserPoolDataSource exten */ @Override public Reference getReference() throws NamingException { - Reference ref = new Reference(getClass().getName(), + final Reference ref = new Reference(getClass().getName(), PerUserPoolDataSourceFactory.class.getName(), null); ref.add(new StringRefAddr("instanceKey", getInstanceKey())); return ref; @@ -1008,18 +1008,18 @@ public class PerUserPoolDataSource exten private synchronized void registerPool(String username, String password) throws NamingException, SQLException { - ConnectionPoolDataSource cpds = testCPDS(username, password); + final ConnectionPoolDataSource cpds = testCPDS(username, password); // Set up the factory we will use (passing the pool associates // the factory with the pool, so we do not have to do so // explicitly) - CPDSConnectionFactory factory = new CPDSConnectionFactory(cpds, + final CPDSConnectionFactory factory = new CPDSConnectionFactory(cpds, getValidationQuery(), getValidationQueryTimeout(), isRollbackAfterValidation(), username, password); factory.setMaxConnLifetimeMillis(getMaxConnLifetimeMillis()); // Create an object pool to contain our PooledConnections - GenericObjectPool<PooledConnectionAndInfo> pool = + final GenericObjectPool<PooledConnectionAndInfo> pool = new GenericObjectPool<>(factory); factory.setPool(pool); pool.setBlockWhenExhausted(getPerUserBlockWhenExhausted(username)); @@ -1045,7 +1045,7 @@ public class PerUserPoolDataSource exten pool.setSwallowedExceptionListener(new SwallowedExceptionLogger(log)); - Object old = managers.put(getPoolKey(username), factory); + final Object old = managers.put(getPoolKey(username), factory); if (old != null) { throw new IllegalStateException("Pool already contains an entry for this user/password: " + username); } @@ -1063,12 +1063,12 @@ public class PerUserPoolDataSource exten try { in.defaultReadObject(); - PerUserPoolDataSource oldDS = (PerUserPoolDataSource) + final PerUserPoolDataSource oldDS = (PerUserPoolDataSource) new PerUserPoolDataSourceFactory() .getObjectInstance(getReference(), null, null, null); this.managers = oldDS.managers; } - catch (NamingException e) + catch (final NamingException e) { throw new IOException("NamingException: " + e); } @@ -1082,7 +1082,7 @@ public class PerUserPoolDataSource exten * specified by the PoolKey */ private ObjectPool<PooledConnectionAndInfo> getPool(PoolKey key) { - CPDSConnectionFactory mgr = (CPDSConnectionFactory) managers.get(key); + final CPDSConnectionFactory mgr = (CPDSConnectionFactory) managers.get(key); return mgr == null ? null : mgr.getPool(); } }