Modified: tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/DelegatingStatement.java URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/DelegatingStatement.java?rev=1743719&r1=1743718&r2=1743719&view=diff ============================================================================== --- tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/DelegatingStatement.java (original) +++ tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/DelegatingStatement.java Fri May 13 18:49:32 2016 @@ -56,7 +56,7 @@ public class DelegatingStatement extends * @param s the {@link Statement} to delegate all calls to. * @param c the {@link DelegatingConnection} that created this statement. */ - public DelegatingStatement(DelegatingConnection<?> c, Statement s) { + public DelegatingStatement(final DelegatingConnection<?> c, final Statement s) { super(c); _stmt = s; _conn = c; @@ -104,7 +104,7 @@ public class DelegatingStatement extends * Sets my delegate. * @param s The statement */ - public void setDelegate(Statement s) { + public void setDelegate(final Statement s) { _stmt = s; } @@ -114,7 +114,7 @@ public class DelegatingStatement extends return _closed; } - protected void setClosedInternal(boolean closed) { + protected void setClosedInternal(final boolean closed) { this._closed = closed; } @@ -146,10 +146,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(); @@ -159,7 +159,7 @@ public class DelegatingStatement extends _stmt.close(); } } - catch (SQLException e) { + catch (final SQLException e) { handleException(e); } } @@ -169,7 +169,7 @@ public class DelegatingStatement extends } } - protected void handleException(SQLException e) throws SQLException { + protected void handleException(final SQLException e) throws SQLException { if (_conn != null) { _conn.handleException(e); } @@ -201,7 +201,7 @@ public class DelegatingStatement extends } @Override - public ResultSet executeQuery(String sql) throws SQLException { + public ResultSet executeQuery(final String sql) throws SQLException { checkOpen(); if (_conn != null) { _conn.setLastUsed(); @@ -209,7 +209,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(); } @@ -221,78 +221,78 @@ public class DelegatingStatement extends try { return DelegatingResultSet.wrapResultSet(this,_stmt.getResultSet()); } - catch (SQLException e) { + catch (final SQLException e) { handleException(e); throw new AssertionError(); } } @Override - public int executeUpdate(String sql) throws SQLException { + public int executeUpdate(final String sql) throws SQLException { checkOpen(); if (_conn != null) { _conn.setLastUsed(); } 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); } } + public void setMaxFieldSize(final int max) throws SQLException + { 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); } } + public void setMaxRows(final int max) throws SQLException + { 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); } } + public void setEscapeProcessing(final boolean enable) throws SQLException + { 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); } } + public void setQueryTimeout(final int seconds) throws SQLException + { 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); } } + public void setCursorName(final String name) throws SQLException + { checkOpen(); try { _stmt.setCursorName(name); } catch (final SQLException e) { handleException(e); } } @Override - public boolean execute(String sql) throws SQLException { + public boolean execute(final String sql) throws SQLException { checkOpen(); if (_conn != null) { _conn.setLastUsed(); } try { return _stmt.execute(sql); - } catch (SQLException e) { + } catch (final SQLException e) { handleException(e); return false; } @@ -300,43 +300,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); } } + public void setFetchDirection(final int direction) throws SQLException + { 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); } } + public void setFetchSize(final int rows) throws SQLException + { 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); } } + public void addBatch(final String sql) throws SQLException + { 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 { @@ -346,7 +346,7 @@ public class DelegatingStatement extends } try { return _stmt.executeBatch(); - } catch (SQLException e) { + } catch (final SQLException e) { handleException(e); throw new AssertionError(); } @@ -363,99 +363,99 @@ 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; } } + public boolean getMoreResults(final int current) throws SQLException + { 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(); } } @Override - public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { + public int executeUpdate(final String sql, final int autoGeneratedKeys) throws SQLException { checkOpen(); if (_conn != null) { _conn.setLastUsed(); } try { return _stmt.executeUpdate(sql, autoGeneratedKeys); - } catch (SQLException e) { + } catch (final SQLException e) { handleException(e); return 0; } } @Override - public int executeUpdate(String sql, int columnIndexes[]) throws SQLException { + public int executeUpdate(final String sql, final int columnIndexes[]) throws SQLException { checkOpen(); if (_conn != null) { _conn.setLastUsed(); } try { return _stmt.executeUpdate(sql, columnIndexes); - } catch (SQLException e) { + } catch (final SQLException e) { handleException(e); return 0; } } @Override - public int executeUpdate(String sql, String columnNames[]) throws SQLException { + public int executeUpdate(final String sql, final String columnNames[]) throws SQLException { checkOpen(); if (_conn != null) { _conn.setLastUsed(); } try { return _stmt.executeUpdate(sql, columnNames); - } catch (SQLException e) { + } catch (final SQLException e) { handleException(e); return 0; } } @Override - public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { + public boolean execute(final String sql, final int autoGeneratedKeys) throws SQLException { checkOpen(); if (_conn != null) { _conn.setLastUsed(); } try { return _stmt.execute(sql, autoGeneratedKeys); - } catch (SQLException e) { + } catch (final SQLException e) { handleException(e); return false; } } @Override - public boolean execute(String sql, int columnIndexes[]) throws SQLException { + public boolean execute(final String sql, final int columnIndexes[]) throws SQLException { checkOpen(); if (_conn != null) { _conn.setLastUsed(); } try { return _stmt.execute(sql, columnIndexes); - } catch (SQLException e) { + } catch (final SQLException e) { handleException(e); return false; } } @Override - public boolean execute(String sql, String columnNames[]) throws SQLException { + public boolean execute(final String sql, final String columnNames[]) throws SQLException { checkOpen(); if (_conn != null) { _conn.setLastUsed(); } try { return _stmt.execute(sql, columnNames); - } catch (SQLException e) { + } catch (final SQLException e) { handleException(e); return false; } @@ -463,7 +463,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 @@ -475,7 +475,7 @@ public class DelegatingStatement extends @Override - public boolean isWrapperFor(Class<?> iface) throws SQLException { + public boolean isWrapperFor(final Class<?> iface) throws SQLException { if (iface.isAssignableFrom(getClass())) { return true; } else if (iface.isAssignableFrom(_stmt.getClass())) { @@ -486,7 +486,7 @@ public class DelegatingStatement extends } @Override - public <T> T unwrap(Class<T> iface) throws SQLException { + public <T> T unwrap(final Class<T> iface) throws SQLException { if (iface.isAssignableFrom(getClass())) { return iface.cast(this); } else if (iface.isAssignableFrom(_stmt.getClass())) { @@ -497,12 +497,12 @@ public class DelegatingStatement extends } @Override - public void setPoolable(boolean poolable) throws SQLException { + public void setPoolable(final boolean poolable) throws SQLException { checkOpen(); try { _stmt.setPoolable(poolable); } - catch (SQLException e) { + catch (final SQLException e) { handleException(e); } } @@ -513,7 +513,7 @@ public class DelegatingStatement extends try { return _stmt.isPoolable(); } - catch (SQLException e) { + catch (final SQLException e) { handleException(e); return false; } @@ -524,7 +524,7 @@ public class DelegatingStatement extends checkOpen(); try { _stmt.closeOnCompletion(); - } catch (SQLException e) { + } catch (final SQLException e) { handleException(e); } } @@ -534,7 +534,7 @@ public class DelegatingStatement extends checkOpen(); try { return _stmt.isCloseOnCompletion(); - } catch (SQLException e) { + } catch (final SQLException e) { handleException(e); return false; }
Modified: tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/DriverConnectionFactory.java URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/DriverConnectionFactory.java?rev=1743719&r1=1743718&r2=1743719&view=diff ============================================================================== --- tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/DriverConnectionFactory.java (original) +++ tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/DriverConnectionFactory.java Fri May 13 18:49:32 2016 @@ -27,7 +27,7 @@ import java.util.Properties; * @since 2.0 */ public class DriverConnectionFactory implements ConnectionFactory { - public DriverConnectionFactory(Driver driver, String connectUri, Properties props) { + public DriverConnectionFactory(final Driver driver, final String connectUri, final Properties props) { _driver = driver; _connectUri = connectUri; _props = props; Modified: tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/DriverManagerConnectionFactory.java URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/DriverManagerConnectionFactory.java?rev=1743719&r1=1743718&r2=1743719&view=diff ============================================================================== --- tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/DriverManagerConnectionFactory.java (original) +++ tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/DriverManagerConnectionFactory.java Fri May 13 18:49:32 2016 @@ -47,7 +47,7 @@ public class DriverManagerConnectionFact * <code> jdbc:<em>subprotocol</em>:<em>subname</em></code> * @since 2.2 */ - public DriverManagerConnectionFactory(String connectUri) { + public DriverManagerConnectionFactory(final String connectUri) { _connectUri = connectUri; _props = new Properties(); } @@ -60,7 +60,7 @@ public class DriverManagerConnectionFact * connection arguments; normally at least a "user" and "password" * property should be included. */ - public DriverManagerConnectionFactory(String connectUri, Properties props) { + public DriverManagerConnectionFactory(final String connectUri, final Properties props) { _connectUri = connectUri; _props = props; } @@ -72,7 +72,7 @@ public class DriverManagerConnectionFact * @param uname the database user * @param passwd the user's password */ - public DriverManagerConnectionFactory(String connectUri, String uname, String passwd) { + public DriverManagerConnectionFactory(final String connectUri, final String uname, final String passwd) { _connectUri = connectUri; _uname = uname; _passwd = passwd; Modified: tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/LifetimeExceededException.java URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/LifetimeExceededException.java?rev=1743719&r1=1743718&r2=1743719&view=diff ============================================================================== --- tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/LifetimeExceededException.java (original) +++ tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/LifetimeExceededException.java Fri May 13 18:49:32 2016 @@ -37,7 +37,7 @@ package org.apache.tomcat.dbcp.dbcp2; * * @param message The message with which to create the exception */ - public LifetimeExceededException(String message) { + public LifetimeExceededException(final String message) { super(message); } } Modified: tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PStmtKey.java URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PStmtKey.java?rev=1743719&r1=1743718&r2=1743719&view=diff ============================================================================== --- tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PStmtKey.java (original) +++ tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PStmtKey.java Fri May 13 18:49:32 2016 @@ -43,19 +43,19 @@ public class PStmtKey { private final StatementType _stmtType; - public PStmtKey(String sql) { + public PStmtKey(final String sql) { this(sql, null, StatementType.PREPARED_STATEMENT, null); } - public PStmtKey(String sql, String catalog) { + public PStmtKey(final String sql, final String catalog) { this(sql, catalog, StatementType.PREPARED_STATEMENT, null); } - public PStmtKey(String sql, String catalog, int autoGeneratedKeys) { + public PStmtKey(final String sql, final String catalog, final int autoGeneratedKeys) { this(sql, catalog, StatementType.PREPARED_STATEMENT, Integer.valueOf(autoGeneratedKeys)); } - public PStmtKey(String sql, String catalog, StatementType stmtType, Integer autoGeneratedKeys) { + public PStmtKey(final String sql, final String catalog, final StatementType stmtType, final Integer autoGeneratedKeys) { _sql = sql; _catalog = catalog; _stmtType = stmtType; @@ -64,15 +64,15 @@ public class PStmtKey { _resultSetConcurrency = null; } - public PStmtKey(String sql, int resultSetType, int resultSetConcurrency) { + public PStmtKey(final String sql, final int resultSetType, final int resultSetConcurrency) { this(sql, null, resultSetType, resultSetConcurrency, StatementType.PREPARED_STATEMENT); } - public PStmtKey(String sql, String catalog, int resultSetType, int resultSetConcurrency) { + public PStmtKey(final String sql, final String catalog, final int resultSetType, final int resultSetConcurrency) { this(sql, catalog, resultSetType, resultSetConcurrency, StatementType.PREPARED_STATEMENT); } - public PStmtKey(String sql, String catalog, int resultSetType, int resultSetConcurrency, StatementType stmtType) { + public PStmtKey(final String sql, final String catalog, final int resultSetType, final int resultSetConcurrency, final StatementType stmtType) { _sql = sql; _catalog = catalog; _resultSetType = Integer.valueOf(resultSetType); @@ -107,7 +107,7 @@ public class PStmtKey { } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if (this == obj) { return true; } @@ -117,7 +117,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; @@ -174,7 +174,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: tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolableCallableStatement.java URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolableCallableStatement.java?rev=1743719&r1=1743718&r2=1743719&view=diff ============================================================================== --- tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolableCallableStatement.java (original) +++ tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolableCallableStatement.java Fri May 13 18:49:32 2016 @@ -54,9 +54,9 @@ public class PoolableCallableStatement e * @param pool the {@link KeyedObjectPool} from which this CallableStatement was obtained * @param conn the {@link DelegatingConnection} that created this CallableStatement */ - public PoolableCallableStatement(CallableStatement stmt, PStmtKey key, - KeyedObjectPool<PStmtKey,DelegatingPreparedStatement> pool, - DelegatingConnection<Connection> conn) { + public PoolableCallableStatement(final CallableStatement stmt, final PStmtKey key, + final KeyedObjectPool<PStmtKey,DelegatingPreparedStatement> pool, + final DelegatingConnection<Connection> conn) { super(conn, stmt); _pool = pool; _key = key; @@ -77,11 +77,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); } } @@ -115,10 +115,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: tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolableConnection.java URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolableConnection.java?rev=1743719&r1=1743718&r2=1743719&view=diff ============================================================================== --- tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolableConnection.java (original) +++ tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolableConnection.java Fri May 13 18:49:32 2016 @@ -90,9 +90,9 @@ public class PoolableConnection extends * @param fastFailValidation true means fatal disconnection errors cause subsequent * validations to fail immediately (no attempt to run query or isValid) */ - public PoolableConnection(Connection conn, - ObjectPool<PoolableConnection> pool, ObjectName jmxName, Collection<String> disconnectSqlCodes, - boolean fastFailValidation) { + public PoolableConnection(final Connection conn, + final ObjectPool<PoolableConnection> pool, final ObjectName jmxName, final Collection<String> disconnectSqlCodes, + final boolean fastFailValidation) { super(conn); _pool = pool; _jmxName = jmxName; @@ -115,8 +115,8 @@ public class PoolableConnection extends * @param pool the pool to which I should return when closed * @param jmxName JMX name */ - public PoolableConnection(Connection conn, - ObjectPool<PoolableConnection> pool, ObjectName jmxName) { + public PoolableConnection(final Connection conn, + final ObjectPool<PoolableConnection> pool, final ObjectName jmxName) { this(conn, pool, jmxName, null, false); } @@ -167,14 +167,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); @@ -191,11 +191,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 { @@ -203,15 +203,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); } } @@ -234,7 +234,7 @@ public class PoolableConnection extends if (validationPreparedStatement != null) { try { validationPreparedStatement.close(); - } catch (SQLException sqle) { + } catch (final SQLException sqle) { // Ignore } } @@ -270,7 +270,7 @@ public class PoolableConnection extends * @param timeout validation timeout * @throws SQLException if validation fails or an SQLException occurs during validation */ - public void validate(String sql, int timeout) throws SQLException { + public void validate(final String sql, int timeout) throws SQLException { if (_fastFailValidation && _fatalSqlExceptionThrown) { throw new SQLException(Utils.getMessage("poolableConnection.validate.fastFail")); } @@ -301,7 +301,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; } } @@ -318,9 +318,9 @@ public class PoolableConnection extends * @param e SQLException to be examined * @return true if the exception signals a disconnection */ - private boolean isDisconnectionSqlException(SQLException e) { + private boolean isDisconnectionSqlException(final 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); @@ -334,7 +334,7 @@ public class PoolableConnection extends } @Override - protected void handleException(SQLException e) throws SQLException { + protected void handleException(final SQLException e) throws SQLException { _fatalSqlExceptionThrown |= isDisconnectionSqlException(e); super.handleException(e); } Modified: tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolableConnectionFactory.java URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolableConnectionFactory.java?rev=1743719&r1=1743718&r2=1743719&view=diff ============================================================================== --- tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolableConnectionFactory.java (original) +++ tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolableConnectionFactory.java Fri May 13 18:49:32 2016 @@ -57,8 +57,8 @@ public class PoolableConnectionFactory * @param dataSourceJmxName The JMX name * base {@link Connection}s */ - public PoolableConnectionFactory(ConnectionFactory connFactory, - ObjectName dataSourceJmxName) { + public PoolableConnectionFactory(final ConnectionFactory connFactory, + final ObjectName dataSourceJmxName) { _connFactory = connFactory; this.dataSourceJmxName = dataSourceJmxName; } @@ -70,7 +70,7 @@ public class PoolableConnectionFactory * * @param validationQuery a query to use to {@link #validateObject validate} {@link Connection}s. */ - public void setValidationQuery(String validationQuery) { + public void setValidationQuery(final String validationQuery) { _validationQuery = validationQuery; } @@ -82,7 +82,7 @@ public class PoolableConnectionFactory * * @param timeout new validation query timeout value in seconds */ - public void setValidationQueryTimeout(int timeout) { + public void setValidationQueryTimeout(final int timeout) { _validationQueryTimeout = timeout; } @@ -91,7 +91,7 @@ public class PoolableConnectionFactory * Using {@code null} turns off connection initialization. * @param connectionInitSqls SQL statement to initialize {@link Connection}s. */ - public void setConnectionInitSql(Collection<String> connectionInitSqls) { + public void setConnectionInitSql(final Collection<String> connectionInitSqls) { _connectionInitSqls = connectionInitSqls; } @@ -99,11 +99,11 @@ public class PoolableConnectionFactory * Sets the {@link ObjectPool} in which to pool {@link Connection}s. * @param pool the {@link ObjectPool} in which to pool those {@link Connection}s */ - public synchronized void setPool(ObjectPool<PoolableConnection> pool) { + public synchronized void setPool(final ObjectPool<PoolableConnection> pool) { if(null != _pool && pool != _pool) { try { _pool.close(); - } catch(Exception e) { + } catch(final Exception e) { // ignored !?! } } @@ -122,7 +122,7 @@ public class PoolableConnectionFactory * Sets the default "read only" setting for borrowed {@link Connection}s * @param defaultReadOnly the default "read only" setting for borrowed {@link Connection}s */ - public void setDefaultReadOnly(Boolean defaultReadOnly) { + public void setDefaultReadOnly(final Boolean defaultReadOnly) { _defaultReadOnly = defaultReadOnly; } @@ -130,7 +130,7 @@ public class PoolableConnectionFactory * Sets the default "auto commit" setting for borrowed {@link Connection}s * @param defaultAutoCommit the default "auto commit" setting for borrowed {@link Connection}s */ - public void setDefaultAutoCommit(Boolean defaultAutoCommit) { + public void setDefaultAutoCommit(final Boolean defaultAutoCommit) { _defaultAutoCommit = defaultAutoCommit; } @@ -138,7 +138,7 @@ public class PoolableConnectionFactory * Sets the default "Transaction Isolation" setting for borrowed {@link Connection}s * @param defaultTransactionIsolation the default "Transaction Isolation" setting for returned {@link Connection}s */ - public void setDefaultTransactionIsolation(int defaultTransactionIsolation) { + public void setDefaultTransactionIsolation(final int defaultTransactionIsolation) { _defaultTransactionIsolation = defaultTransactionIsolation; } @@ -146,19 +146,19 @@ public class PoolableConnectionFactory * Sets the default "catalog" setting for borrowed {@link Connection}s * @param defaultCatalog the default "catalog" setting for borrowed {@link Connection}s */ - public void setDefaultCatalog(String defaultCatalog) { + public void setDefaultCatalog(final String defaultCatalog) { _defaultCatalog = defaultCatalog; } - public void setCacheState(boolean cacheState) { + public void setCacheState(final boolean cacheState) { this._cacheState = cacheState; } - public void setPoolStatements(boolean poolStatements) { + public void setPoolStatements(final boolean poolStatements) { this.poolStatements = poolStatements; } - public void setMaxOpenPrepatedStatements(int maxOpenPreparedStatements) { + public void setMaxOpenPrepatedStatements(final int maxOpenPreparedStatements) { this.maxOpenPreparedStatements = maxOpenPreparedStatements; } @@ -169,7 +169,7 @@ public class PoolableConnectionFactory * is -1. * @param maxConnLifetimeMillis The maximum connection lifetime */ - public void setMaxConnLifetimeMillis(long maxConnLifetimeMillis) { + public void setMaxConnLifetimeMillis(final long maxConnLifetimeMillis) { this.maxConnLifetimeMillis = maxConnLifetimeMillis; } @@ -178,7 +178,7 @@ public class PoolableConnectionFactory return enableAutoCommitOnReturn; } - public void setEnableAutoCommitOnReturn(boolean enableAutoCommitOnReturn) { + public void setEnableAutoCommitOnReturn(final boolean enableAutoCommitOnReturn) { this.enableAutoCommitOnReturn = enableAutoCommitOnReturn; } @@ -187,7 +187,7 @@ public class PoolableConnectionFactory return rollbackOnReturn; } - public void setRollbackOnReturn(boolean rollbackOnReturn) { + public void setRollbackOnReturn(final boolean rollbackOnReturn) { this.rollbackOnReturn = rollbackOnReturn; } @@ -195,7 +195,7 @@ public class PoolableConnectionFactory return defaultQueryTimeout; } - public void setDefaultQueryTimeout(Integer defaultQueryTimeout) { + public void setDefaultQueryTimeout(final Integer defaultQueryTimeout) { this.defaultQueryTimeout = defaultQueryTimeout; } @@ -225,7 +225,7 @@ public class PoolableConnectionFactory * @param disconnectionSqlCodes The disconnection codes * @since 2.1 */ - public void setDisconnectionSqlCodes(Collection<String> disconnectionSqlCodes) { + public void setDisconnectionSqlCodes(final Collection<String> disconnectionSqlCodes) { _disconnectionSqlCodes = disconnectionSqlCodes; } @@ -248,7 +248,7 @@ public class PoolableConnectionFactory * fast fail validation * @since 2.1 */ - public void setFastFailValidation(boolean fastFailValidation) { + public void setFastFailValidation(final boolean fastFailValidation) { _fastFailValidation = fastFailValidation; } @@ -260,29 +260,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()); @@ -290,7 +290,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); @@ -305,20 +305,21 @@ 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); + pc.setCacheState(_cacheState); return new DefaultPooledObject<>(pc); } - protected void initializeConnection(Connection conn) throws SQLException { - Collection<String> sqls = _connectionInitSqls; + protected void initializeConnection(final Connection conn) throws SQLException { + 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"); @@ -330,19 +331,19 @@ public class PoolableConnectionFactory } @Override - public void destroyObject(PooledObject<PoolableConnection> p) + public void destroyObject(final PooledObject<PoolableConnection> p) throws Exception { p.getObject().reallyClose(); } @Override - public boolean validateObject(PooledObject<PoolableConnection> p) { + public boolean validateObject(final PooledObject<PoolableConnection> p) { try { validateLifetime(p); validateConnection(p.getObject()); return true; - } catch (Exception e) { + } catch (final Exception e) { if (log.isDebugEnabled()) { log.debug(Utils.getMessage( "poolableConnectionFactory.validateObject.fail"), e); @@ -351,7 +352,7 @@ public class PoolableConnectionFactory } } - public void validateConnection(PoolableConnection conn) throws SQLException { + public void validateConnection(final PoolableConnection conn) throws SQLException { if(conn.isClosed()) { throw new SQLException("validateConnection: connection closed"); } @@ -359,12 +360,12 @@ public class PoolableConnectionFactory } @Override - public void passivateObject(PooledObject<PoolableConnection> p) + public void passivateObject(final PooledObject<PoolableConnection> p) throws Exception { validateLifetime(p); - PoolableConnection conn = p.getObject(); + final PoolableConnection conn = p.getObject(); Boolean connAutoCommit = null; if (rollbackOnReturn) { connAutoCommit = Boolean.valueOf(conn.getAutoCommit()); @@ -390,12 +391,12 @@ public class PoolableConnectionFactory } @Override - public void activateObject(PooledObject<PoolableConnection> p) + public void activateObject(final PooledObject<PoolableConnection> p) throws Exception { validateLifetime(p); - PoolableConnection conn = p.getObject(); + final PoolableConnection conn = p.getObject(); conn.activate(); if (_defaultAutoCommit != null && @@ -417,10 +418,10 @@ public class PoolableConnectionFactory conn.setDefaultQueryTimeout(defaultQueryTimeout); } - private void validateLifetime(PooledObject<PoolableConnection> p) + private void validateLifetime(final 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: tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolablePreparedStatement.java URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolablePreparedStatement.java?rev=1743719&r1=1743718&r2=1743719&view=diff ============================================================================== --- tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolablePreparedStatement.java (original) +++ tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolablePreparedStatement.java Fri May 13 18:49:32 2016 @@ -43,7 +43,7 @@ public class PoolablePreparedStatement<K /** * The {@link KeyedObjectPool} from which I was obtained. */ - private final KeyedObjectPool<K,PoolablePreparedStatement<K>> _pool; + private final KeyedObjectPool<K, PoolablePreparedStatement<K>> _pool; /** * My "key" as used by {@link KeyedObjectPool}. @@ -59,9 +59,9 @@ public class PoolablePreparedStatement<K * @param pool the {@link KeyedObjectPool} from which I was obtained. * @param conn the {@link java.sql.Connection Connection} from which I was created */ - public PoolablePreparedStatement(PreparedStatement stmt, K key, - KeyedObjectPool<K, PoolablePreparedStatement<K>> pool, - DelegatingConnection<?> conn) { + public PoolablePreparedStatement(final PreparedStatement stmt, final K key, + final KeyedObjectPool<K, PoolablePreparedStatement<K>> pool, + final DelegatingConnection<?> conn) { super(conn, stmt); _pool = pool; _key = key; @@ -100,11 +100,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); } } @@ -135,10 +135,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: tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolingConnection.java URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolingConnection.java?rev=1743719&r1=1743718&r2=1743719&view=diff ============================================================================== --- tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolingConnection.java (original) +++ tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolingConnection.java Fri May 13 18:49:32 2016 @@ -56,13 +56,13 @@ public class PoolingConnection extends D * Constructor. * @param c the underlying {@link Connection}. */ - public PoolingConnection(Connection c) { + public PoolingConnection(final Connection c) { super(c); } public void setStatementPool( - KeyedObjectPool<PStmtKey,DelegatingPreparedStatement> pool) { + final KeyedObjectPool<PStmtKey,DelegatingPreparedStatement> pool) { _pstmtPool = pool; } @@ -76,13 +76,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); } } @@ -101,24 +101,24 @@ public class PoolingConnection extends D * @return a {@link PoolablePreparedStatement} */ @Override - public PreparedStatement prepareStatement(String sql) throws SQLException { + public PreparedStatement prepareStatement(final String sql) throws SQLException { if (null == _pstmtPool) { throw new SQLException( "Statement pool is null - closed or invalid PoolingConnection."); } 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); } } @Override - public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { + public PreparedStatement prepareStatement(final String sql, final int autoGeneratedKeys) throws SQLException { if (null == _pstmtPool) { throw new SQLException( "Statement pool is null - closed or invalid PoolingConnection."); @@ -126,13 +126,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); } } @@ -146,18 +146,18 @@ public class PoolingConnection extends D * @throws SQLException An error occurred */ @Override - public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { + public PreparedStatement prepareStatement(final String sql, final int resultSetType, final int resultSetConcurrency) throws SQLException { if (null == _pstmtPool) { throw new SQLException( "Statement pool is null - closed or invalid PoolingConnection."); } 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); } } @@ -169,14 +169,14 @@ public class PoolingConnection extends D * @throws SQLException An error occurred */ @Override - public CallableStatement prepareCall(String sql) throws SQLException { + public CallableStatement prepareCall(final 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); } } @@ -190,15 +190,15 @@ public class PoolingConnection extends D * @throws SQLException An error occurred */ @Override - public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { + public CallableStatement prepareCall(final String sql, final int resultSetType, final int resultSetConcurrency) throws SQLException { 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); } } @@ -224,11 +224,11 @@ public class PoolingConnection extends D // return super.prepareStatement(sql, columnNames); // } - protected PStmtKey createKey(String sql, int autoGeneratedKeys) { + protected PStmtKey createKey(final String sql, final int autoGeneratedKeys) { String catalog = null; try { catalog = getCatalog(); - } catch (SQLException e) { + } catch (final SQLException e) { // Ignored } return new PStmtKey(normalizeSQL(sql), catalog, autoGeneratedKeys); @@ -241,11 +241,11 @@ public class PoolingConnection extends D * @param resultSetConcurrency result set concurrency * @return the key */ - protected PStmtKey createKey(String sql, int resultSetType, int resultSetConcurrency) { + protected PStmtKey createKey(final String sql, final int resultSetType, final int resultSetConcurrency) { String catalog = null; try { catalog = getCatalog(); - } catch (SQLException e) { + } catch (final SQLException e) { // Ignored } return new PStmtKey(normalizeSQL(sql), catalog, resultSetType, resultSetConcurrency); @@ -259,11 +259,11 @@ public class PoolingConnection extends D * @param stmtType statement type * @return the key */ - protected PStmtKey createKey(String sql, int resultSetType, int resultSetConcurrency, StatementType stmtType) { + protected PStmtKey createKey(final String sql, final int resultSetType, final int resultSetConcurrency, final StatementType stmtType) { String catalog = null; try { catalog = getCatalog(); - } catch (SQLException e) { + } catch (final SQLException e) { // Ignored } return new PStmtKey(normalizeSQL(sql), catalog, resultSetType, resultSetConcurrency, stmtType); @@ -274,11 +274,11 @@ public class PoolingConnection extends D * @param sql the sql string used to define the statement * @return the key */ - protected PStmtKey createKey(String sql) { + protected PStmtKey createKey(final String sql) { String catalog = null; try { catalog = getCatalog(); - } catch (SQLException e) { + } catch (final SQLException e) { // Ignored } return new PStmtKey(normalizeSQL(sql), catalog); @@ -290,11 +290,11 @@ public class PoolingConnection extends D * @param stmtType statement type * @return the key */ - protected PStmtKey createKey(String sql, StatementType stmtType) { + protected PStmtKey createKey(final String sql, final StatementType stmtType) { String catalog = null; try { catalog = getCatalog(); - } catch (SQLException e) { + } catch (final SQLException e) { // Ignored } return new PStmtKey(normalizeSQL(sql), catalog, stmtType, null); @@ -306,7 +306,7 @@ public class PoolingConnection extends D * @param sql The SQL statement * @return the trimmed SQL statement */ - protected String normalizeSQL(String sql) { + protected String normalizeSQL(final String sql) { return sql.trim(); } @@ -322,7 +322,7 @@ public class PoolingConnection extends D * @see #createKey(String, int, int, StatementType) */ @Override - public PooledObject<DelegatingPreparedStatement> makeObject(PStmtKey key) + public PooledObject<DelegatingPreparedStatement> makeObject(final PStmtKey key) throws Exception { if(null == key) { throw new IllegalArgumentException("Prepared statement key is null or invalid."); @@ -330,6 +330,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); @@ -338,12 +339,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); @@ -364,8 +367,8 @@ public class PoolingConnection extends D * @throws Exception An error occurred */ @Override - public void destroyObject(PStmtKey key, - PooledObject<DelegatingPreparedStatement> p) + public void destroyObject(final PStmtKey key, + final PooledObject<DelegatingPreparedStatement> p) throws Exception { p.getObject().getInnermostDelegate().close(); } @@ -379,8 +382,8 @@ public class PoolingConnection extends D * @return {@code true} */ @Override - public boolean validateObject(PStmtKey key, - PooledObject<DelegatingPreparedStatement> p) { + public boolean validateObject(final PStmtKey key, + final PooledObject<DelegatingPreparedStatement> p) { return true; } @@ -393,8 +396,8 @@ public class PoolingConnection extends D * @throws Exception An error occurred */ @Override - public void activateObject(PStmtKey key, - PooledObject<DelegatingPreparedStatement> p) throws Exception { + public void activateObject(final PStmtKey key, + final PooledObject<DelegatingPreparedStatement> p) throws Exception { p.getObject().activate(); } @@ -408,9 +411,9 @@ public class PoolingConnection extends D * @throws Exception An error occurred */ @Override - public void passivateObject(PStmtKey key, - PooledObject<DelegatingPreparedStatement> p) throws Exception { - DelegatingPreparedStatement dps = p.getObject(); + public void passivateObject(final PStmtKey key, + final PooledObject<DelegatingPreparedStatement> p) throws Exception { + final DelegatingPreparedStatement dps = p.getObject(); dps.clearParameters(); dps.passivate(); } Modified: tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolingDataSource.java URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolingDataSource.java?rev=1743719&r1=1743718&r2=1743719&view=diff ============================================================================== --- tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolingDataSource.java (original) +++ tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolingDataSource.java Fri May 13 18:49:32 2016 @@ -49,20 +49,21 @@ public class PoolingDataSource<C extends /** Controls access to the underlying connection */ private boolean accessToUnderlyingConnectionAllowed = false; - public PoolingDataSource(ObjectPool<C> pool) { + public PoolingDataSource(final ObjectPool<C> pool) { if (null == pool) { throw new NullPointerException("Pool must not be null."); } _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); } @@ -77,9 +78,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); } } @@ -100,18 +101,18 @@ public class PoolingDataSource<C extends * * @param allow Access to the underlying connection is granted when true. */ - public void setAccessToUnderlyingConnectionAllowed(boolean allow) { + public void setAccessToUnderlyingConnectionAllowed(final boolean allow) { this.accessToUnderlyingConnectionAllowed = allow; } /* JDBC_4_ANT_KEY_BEGIN */ @Override - public boolean isWrapperFor(Class<?> iface) throws SQLException { + public boolean isWrapperFor(final Class<?> iface) throws SQLException { return false; } @Override - public <T> T unwrap(Class<T> iface) throws SQLException { + public <T> T unwrap(final Class<T> iface) throws SQLException { throw new SQLException("PoolingDataSource is not a wrapper."); } /* JDBC_4_ANT_KEY_END */ @@ -130,18 +131,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); } } @@ -151,7 +152,7 @@ public class PoolingDataSource<C extends * @throws UnsupportedOperationException This is unsupported */ @Override - public Connection getConnection(String uname, String passwd) throws SQLException { + public Connection getConnection(final String uname, final String passwd) throws SQLException { throw new UnsupportedOperationException(); } @@ -181,7 +182,7 @@ public class PoolingDataSource<C extends * implementation does not support this feature. */ @Override - public void setLoginTimeout(int seconds) { + public void setLoginTimeout(final int seconds) { throw new UnsupportedOperationException("Login timeout is not supported."); } @@ -190,7 +191,7 @@ public class PoolingDataSource<C extends * @see DataSource#setLogWriter */ @Override - public void setLogWriter(PrintWriter out) { + public void setLogWriter(final PrintWriter out) { _logWriter = out; } @@ -211,7 +212,7 @@ public class PoolingDataSource<C extends private class PoolGuardConnectionWrapper<D extends Connection> extends DelegatingConnection<D> { - PoolGuardConnectionWrapper(D delegate) { + PoolGuardConnectionWrapper(final D delegate) { super(delegate); } Modified: tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolingDriver.java URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolingDriver.java?rev=1743719&r1=1743718&r2=1743719&view=diff ============================================================================== --- tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolingDriver.java (original) +++ tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolingDriver.java Fri May 13 18:49:32 2016 @@ -47,7 +47,7 @@ public class PoolingDriver implements Dr static { try { DriverManager.registerDriver(new PoolingDriver()); - } catch(Exception e) { + } catch(final Exception e) { } } @@ -70,7 +70,7 @@ public class PoolingDriver implements Dr * For unit testing purposes. * @param accessToUnderlyingConnectionAllowed The new flag */ - protected PoolingDriver(boolean accessToUnderlyingConnectionAllowed) { + protected PoolingDriver(final boolean accessToUnderlyingConnectionAllowed) { this.accessToUnderlyingConnectionAllowed = accessToUnderlyingConnectionAllowed; } @@ -85,66 +85,66 @@ public class PoolingDriver implements Dr return accessToUnderlyingConnectionAllowed; } - public synchronized ObjectPool<? extends Connection> getConnectionPool(String name) + public synchronized ObjectPool<? extends Connection> getConnectionPool(final 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."); } return pool; } - public synchronized void registerPool(String name, - ObjectPool<? extends Connection> pool) { + public synchronized void registerPool(final String name, + final ObjectPool<? extends Connection> pool) { pools.put(name,pool); } - public synchronized void closePool(String name) throws SQLException { - ObjectPool<? extends Connection> pool = pools.get(name); + public synchronized void closePool(final String name) throws SQLException { + 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()]); } @Override - public boolean acceptsURL(String url) throws SQLException { + public boolean acceptsURL(final String url) throws SQLException { try { return url.startsWith(URL_PREFIX); - } catch(NullPointerException e) { + } catch(final NullPointerException e) { return false; } } @Override - public Connection connect(String url, Properties info) throws SQLException { + public Connection connect(final String url, final 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); } } @@ -164,15 +164,16 @@ public class PoolingDriver implements Dr * <code>PoolGuardConnectionWrapper</code> or an error occurs invalidating * the connection */ - public void invalidateConnection(Connection conn) throws SQLException { + public void invalidateConnection(final 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 { @@ -196,7 +197,7 @@ public class PoolingDriver implements Dr } @Override - public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) { + public DriverPropertyInfo[] getPropertyInfo(final String url, final Properties info) { return new DriverPropertyInfo[0]; } @@ -217,8 +218,8 @@ public class PoolingDriver implements Dr private final ObjectPool<? extends Connection> pool; - PoolGuardConnectionWrapper(ObjectPool<? extends Connection> pool, - Connection delegate) { + PoolGuardConnectionWrapper(final ObjectPool<? extends Connection> pool, + final Connection delegate) { super(delegate); this.pool = pool; } Modified: tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/SwallowedExceptionLogger.java URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/SwallowedExceptionLogger.java?rev=1743719&r1=1743718&r2=1743719&view=diff ============================================================================== --- tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/SwallowedExceptionLogger.java (original) +++ tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/SwallowedExceptionLogger.java Fri May 13 18:49:32 2016 @@ -34,7 +34,7 @@ public class SwallowedExceptionLogger im * * @param log logger */ - public SwallowedExceptionLogger(Log log) { + public SwallowedExceptionLogger(final Log log) { this(log, true); } @@ -45,13 +45,13 @@ public class SwallowedExceptionLogger im * @param log logger * @param logExpiredConnections false suppresses logging of expired connection events */ - public SwallowedExceptionLogger(Log log, boolean logExpiredConnections) { + public SwallowedExceptionLogger(final Log log, final boolean logExpiredConnections) { this.log = log; this.logExpiredConnections = logExpiredConnections; } @Override - public void onSwallowException(Exception e) { + public void onSwallowException(final Exception e) { if (logExpiredConnections || !(e instanceof LifetimeExceededException)) { log.warn(Utils.getMessage( "swallowedExceptionLogger.onSwallowedException"), e); Modified: tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/Utils.java URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/Utils.java?rev=1743719&r1=1743718&r2=1743719&view=diff ============================================================================== --- tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/Utils.java (original) +++ tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/Utils.java Fri May 13 18:49:32 2016 @@ -73,11 +73,11 @@ public final class Utils { * * @param rset a ResultSet, may be {@code null} */ - public static void closeQuietly(ResultSet rset) { + public static void closeQuietly(final ResultSet rset) { if (rset != null) { try { rset.close(); - } catch (Exception e) { + } catch (final Exception e) { // ignored } } @@ -88,11 +88,11 @@ public final class Utils { * * @param conn a Connection, may be {@code null} */ - public static void closeQuietly(Connection conn) { + public static void closeQuietly(final Connection conn) { if (conn != null) { try { conn.close(); - } catch (Exception e) { + } catch (final Exception e) { // ignored } } @@ -103,11 +103,11 @@ public final class Utils { * * @param stmt a Statement, may be {@code null} */ - public static void closeQuietly(Statement stmt) { + public static void closeQuietly(final Statement stmt) { if (stmt != null) { try { stmt.close(); - } catch (Exception e) { + } catch (final Exception e) { // ignored } } @@ -119,7 +119,7 @@ public final class Utils { * @param key The message key * @return the message */ - public static String getMessage(String key) { + public static String getMessage(final String key) { return getMessage(key, (Object[]) null); } @@ -131,12 +131,12 @@ public final class Utils { * @param args The arguments * @return the message */ - public static String getMessage(String key, Object... args) { - String msg = messages.getString(key); + public static String getMessage(final String key, final Object... args) { + 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: tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/cpdsadapter/ConnectionImpl.java URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/cpdsadapter/ConnectionImpl.java?rev=1743719&r1=1743718&r2=1743719&view=diff ============================================================================== --- tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/cpdsadapter/ConnectionImpl.java (original) +++ tomcat/tc8.5.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/cpdsadapter/ConnectionImpl.java Fri May 13 18:49:32 2016 @@ -27,9 +27,9 @@ import org.apache.tomcat.dbcp.dbcp2.Dele /** * This class is the <code>Connection</code> that will be returned * from <code>PooledConnectionImpl.getConnection()</code>. - * Most methods are wrappers around the jdbc 1.x <code>Connection</code>. + * Most methods are wrappers around the JDBC 1.x <code>Connection</code>. * A few exceptions include preparedStatement and close. - * In accordance with the jdbc specification this Connection cannot + * In accordance with the JDBC specification this Connection cannot * be used after closed() is called. Any further usage will result in an * SQLException. * @@ -53,9 +53,9 @@ class ConnectionImpl extends DelegatingC * @param connection The JDBC 1.x Connection to wrap. * @param accessToUnderlyingConnectionAllowed if true, then access is allowed to the underlying connection */ - ConnectionImpl(PooledConnectionImpl pooledConnection, - Connection connection, - boolean accessToUnderlyingConnectionAllowed) { + ConnectionImpl(final PooledConnectionImpl pooledConnection, + final Connection connection, + final boolean accessToUnderlyingConnectionAllowed) { super(connection); this.pooledConnection = pooledConnection; this.accessToUnderlyingConnectionAllowed = @@ -65,7 +65,7 @@ class ConnectionImpl extends DelegatingC /** * Marks the Connection as closed, and notifies the pool that the * pooled connection is available. - * In accordance with the jdbc specification this Connection cannot + * In accordance with the JDBC specification this Connection cannot * be used after closed() is called. Any further usage will result in an * SQLException. * @@ -86,7 +86,7 @@ class ConnectionImpl extends DelegatingC /** * If pooling of <code>PreparedStatement</code>s is turned on in the * {@link DriverAdapterCPDS}, a pooled object may be returned, otherwise - * delegate to the wrapped jdbc 1.x {@link java.sql.Connection}. + * delegate to the wrapped JDBC 1.x {@link java.sql.Connection}. * * @param sql SQL statement to be prepared * @return the prepared statement @@ -94,13 +94,13 @@ class ConnectionImpl extends DelegatingC * in the wrapped connection. */ @Override - public PreparedStatement prepareStatement(String sql) throws SQLException { + public PreparedStatement prepareStatement(final String sql) throws SQLException { checkOpen(); try { return new DelegatingPreparedStatement (this, pooledConnection.prepareStatement(sql)); } - catch (SQLException e) { + catch (final SQLException e) { handleException(e); // Does not return return null; } @@ -109,14 +109,14 @@ class ConnectionImpl extends DelegatingC /** * If pooling of <code>PreparedStatement</code>s is turned on in the * {@link DriverAdapterCPDS}, a pooled object may be returned, otherwise - * delegate to the wrapped jdbc 1.x {@link java.sql.Connection}. + * delegate to the wrapped JDBC 1.x {@link java.sql.Connection}. * * @exception SQLException if this connection is closed or an error occurs * in the wrapped connection. */ @Override - public PreparedStatement prepareStatement(String sql, int resultSetType, - int resultSetConcurrency) + public PreparedStatement prepareStatement(final String sql, final int resultSetType, + final int resultSetConcurrency) throws SQLException { checkOpen(); try { @@ -124,16 +124,16 @@ class ConnectionImpl extends DelegatingC (this, pooledConnection.prepareStatement (sql,resultSetType,resultSetConcurrency)); } - catch (SQLException e) { + catch (final SQLException e) { handleException(e); return null; } } @Override - public PreparedStatement prepareStatement(String sql, int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) + public PreparedStatement prepareStatement(final String sql, final int resultSetType, + final int resultSetConcurrency, + final int resultSetHoldability) throws SQLException { checkOpen(); try { @@ -141,49 +141,49 @@ class ConnectionImpl extends DelegatingC pooledConnection.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability)); } - catch (SQLException e) { + catch (final SQLException e) { handleException(e); return null; } } @Override - public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) + public PreparedStatement prepareStatement(final String sql, final int autoGeneratedKeys) throws SQLException { checkOpen(); try { return new DelegatingPreparedStatement(this, pooledConnection.prepareStatement(sql, autoGeneratedKeys)); } - catch (SQLException e) { + catch (final SQLException e) { handleException(e); return null; } } @Override - public PreparedStatement prepareStatement(String sql, int columnIndexes[]) + public PreparedStatement prepareStatement(final String sql, final int columnIndexes[]) throws SQLException { checkOpen(); try { return new DelegatingPreparedStatement(this, pooledConnection.prepareStatement(sql, columnIndexes)); } - catch (SQLException e) { + catch (final SQLException e) { handleException(e); return null; } } @Override - public PreparedStatement prepareStatement(String sql, String columnNames[]) + public PreparedStatement prepareStatement(final String sql, final String columnNames[]) throws SQLException { checkOpen(); try { return new DelegatingPreparedStatement(this, pooledConnection.prepareStatement(sql, columnNames)); } - catch (SQLException e) { + catch (final SQLException e) { handleException(e); return null; } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org