Author: markt Date: Thu Aug 9 16:50:30 2018 New Revision: 1837746 URL: http://svn.apache.org/viewvc?rev=1837746&view=rev Log: Update the internal fork of Apache Commons DBCP 2 to abc0484 (2018-08-09) to pick up some bug fixes and enhancements.
Modified: tomcat/trunk/MERGE.txt tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSource.java tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSourceFactory.java tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSourceMXBean.java tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/DelegatingCallableStatement.java tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/DelegatingConnection.java tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/DelegatingDatabaseMetaData.java tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/DelegatingPreparedStatement.java tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/DelegatingResultSet.java tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/DelegatingStatement.java tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/DriverConnectionFactory.java tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/DriverManagerConnectionFactory.java tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/PStmtKey.java tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolableConnection.java tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolableConnectionFactory.java tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/PoolingConnection.java tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/Utils.java tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/cpdsadapter/DriverAdapterCPDS.java tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/cpdsadapter/PStmtKeyCPDS.java tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/cpdsadapter/PooledConnectionImpl.java tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/CPDSConnectionFactory.java tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/managed/BasicManagedDataSource.java tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/managed/DataSourceXAConnectionFactory.java tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/managed/ManagedConnection.java tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/managed/PoolableManagedConnection.java tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/managed/TransactionContext.java tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/managed/TransactionRegistry.java tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/managed/XAConnectionFactory.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/MERGE.txt URL: http://svn.apache.org/viewvc/tomcat/trunk/MERGE.txt?rev=1837746&r1=1837745&r2=1837746&view=diff ============================================================================== --- tomcat/trunk/MERGE.txt (original) +++ tomcat/trunk/MERGE.txt Thu Aug 9 16:50:30 2018 @@ -69,7 +69,7 @@ Sub-tree src/main/java/org/apache/commons/dbcp2 src/main/resources/org/apache/commons/dbcp2 The SHA1 ID for the most recent commit to be merged to Tomcat is: -d7aa662fbbb99e536ae28c47d0c4e1d51e39d5b9 +abc048454398d8c9924a1af9c04501817f44a11d Pool2 Sub-tree Modified: tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSource.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSource.java?rev=1837746&r1=1837745&r2=1837746&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSource.java (original) +++ tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSource.java Thu Aug 9 16:50:30 2018 @@ -224,6 +224,11 @@ public class BasicDataSource implements private volatile String defaultCatalog; /** + * The default "schema" of connections created by this pool. + */ + private volatile String defaultSchema; + + /** * Returns the default catalog. * * @return the default catalog @@ -234,6 +239,17 @@ public class BasicDataSource implements } /** + * Returns the default schema. + * + * @return the default schema. + * @since 2.5.0 + */ + @Override + public String getDefaultSchema() { + return this.defaultSchema; + } + + /** * <p> * Sets the default catalog. * </p> @@ -255,6 +271,28 @@ public class BasicDataSource implements } /** + * <p> + * Sets the default schema. + * </p> + * <p> + * Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first + * time one of the following methods is invoked: <code>getConnection, setLogwriter, + * setLoginTimeout, getLoginTimeout, getLogWriter.</code> + * </p> + * + * @param defaultSchema + * the default catalog + * @since 2.5.0 + */ + public void setDefaultSchema(final String defaultSchema) { + if (defaultSchema != null && defaultSchema.trim().length() > 0) { + this.defaultSchema = defaultSchema; + } else { + this.defaultSchema = null; + } + } + + /** * The property that controls if the pooled connections cache some state rather than query the database for current * state to improve performance. */ @@ -2271,11 +2309,11 @@ public class BasicDataSource implements * Closes the connection pool, silently swallowing any exception that occurs. */ private void closeConnectionPool() { - final GenericObjectPool<?> oldpool = connectionPool; + final GenericObjectPool<?> oldPool = connectionPool; connectionPool = null; try { - if (oldpool != null) { - oldpool.close(); + if (oldPool != null) { + oldPool.close(); } } catch (final Exception e) { /* Ignore */ @@ -2330,6 +2368,7 @@ public class BasicDataSource implements connectionFactory.setDefaultAutoCommit(defaultAutoCommit); connectionFactory.setDefaultTransactionIsolation(defaultTransactionIsolation); connectionFactory.setDefaultCatalog(defaultCatalog); + connectionFactory.setDefaultSchema(defaultSchema); connectionFactory.setCacheState(cacheState); connectionFactory.setPoolStatements(poolPreparedStatements); connectionFactory.setMaxOpenPreparedStatements(maxOpenPreparedStatements); Modified: tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSourceFactory.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSourceFactory.java?rev=1837746&r1=1837745&r2=1837746&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSourceFactory.java (original) +++ tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSourceFactory.java Thu Aug 9 16:50:30 2018 @@ -63,6 +63,7 @@ public class BasicDataSourceFactory impl private static final String PROP_DEFAULTREADONLY = "defaultReadOnly"; private static final String PROP_DEFAULTTRANSACTIONISOLATION = "defaultTransactionIsolation"; private static final String PROP_DEFAULTCATALOG = "defaultCatalog"; + private static final String PROP_DEFAULTSCHEMA = "defaultSchema"; private static final String PROP_CACHESTATE = "cacheState"; private static final String PROP_DRIVERCLASSNAME = "driverClassName"; private static final String PROP_LIFO = "lifo"; @@ -130,17 +131,17 @@ public class BasicDataSourceFactory impl private static final String SILENTPROP_AUTH = "auth"; private static final String[] ALL_PROPERTIES = {PROP_DEFAULTAUTOCOMMIT, PROP_DEFAULTREADONLY, - PROP_DEFAULTTRANSACTIONISOLATION, PROP_DEFAULTCATALOG, PROP_CACHESTATE, PROP_DRIVERCLASSNAME, PROP_LIFO, - PROP_MAXTOTAL, PROP_MAXIDLE, PROP_MINIDLE, PROP_INITIALSIZE, PROP_MAXWAITMILLIS, PROP_TESTONCREATE, - PROP_TESTONBORROW, PROP_TESTONRETURN, PROP_TIMEBETWEENEVICTIONRUNSMILLIS, PROP_NUMTESTSPEREVICTIONRUN, - PROP_MINEVICTABLEIDLETIMEMILLIS, PROP_SOFTMINEVICTABLEIDLETIMEMILLIS, PROP_EVICTIONPOLICYCLASSNAME, - PROP_TESTWHILEIDLE, PROP_PASSWORD, PROP_URL, PROP_USERNAME, PROP_VALIDATIONQUERY, - PROP_VALIDATIONQUERY_TIMEOUT, PROP_CONNECTIONINITSQLS, PROP_ACCESSTOUNDERLYINGCONNECTIONALLOWED, - PROP_REMOVEABANDONEDONBORROW, PROP_REMOVEABANDONEDONMAINTENANCE, PROP_REMOVEABANDONEDTIMEOUT, - PROP_LOGABANDONED, PROP_ABANDONEDUSAGETRACKING, PROP_POOLPREPAREDSTATEMENTS, PROP_MAXOPENPREPAREDSTATEMENTS, - PROP_CONNECTIONPROPERTIES, PROP_MAXCONNLIFETIMEMILLIS, PROP_LOGEXPIREDCONNECTIONS, PROP_ROLLBACK_ON_RETURN, - PROP_ENABLE_AUTOCOMMIT_ON_RETURN, PROP_DEFAULT_QUERYTIMEOUT, PROP_FASTFAIL_VALIDATION, - PROP_DISCONNECTION_SQL_CODES, PROP_JMX_NAME }; + PROP_DEFAULTTRANSACTIONISOLATION, PROP_DEFAULTCATALOG, PROP_DEFAULTSCHEMA, PROP_CACHESTATE, + PROP_DRIVERCLASSNAME, PROP_LIFO, PROP_MAXTOTAL, PROP_MAXIDLE, PROP_MINIDLE, PROP_INITIALSIZE, + PROP_MAXWAITMILLIS, PROP_TESTONCREATE, PROP_TESTONBORROW, PROP_TESTONRETURN, + PROP_TIMEBETWEENEVICTIONRUNSMILLIS, PROP_NUMTESTSPEREVICTIONRUN, PROP_MINEVICTABLEIDLETIMEMILLIS, + PROP_SOFTMINEVICTABLEIDLETIMEMILLIS, PROP_EVICTIONPOLICYCLASSNAME, PROP_TESTWHILEIDLE, PROP_PASSWORD, + PROP_URL, PROP_USERNAME, PROP_VALIDATIONQUERY, PROP_VALIDATIONQUERY_TIMEOUT, PROP_CONNECTIONINITSQLS, + PROP_ACCESSTOUNDERLYINGCONNECTIONALLOWED, PROP_REMOVEABANDONEDONBORROW, PROP_REMOVEABANDONEDONMAINTENANCE, + PROP_REMOVEABANDONEDTIMEOUT, PROP_LOGABANDONED, PROP_ABANDONEDUSAGETRACKING, PROP_POOLPREPAREDSTATEMENTS, + PROP_MAXOPENPREPAREDSTATEMENTS, PROP_CONNECTIONPROPERTIES, PROP_MAXCONNLIFETIMEMILLIS, + PROP_LOGEXPIREDCONNECTIONS, PROP_ROLLBACK_ON_RETURN, PROP_ENABLE_AUTOCOMMIT_ON_RETURN, + PROP_DEFAULT_QUERYTIMEOUT, PROP_FASTFAIL_VALIDATION, PROP_DISCONNECTION_SQL_CODES, PROP_JMX_NAME }; /** * Obsolete properties from DBCP 1.x. with warning strings suggesting new properties. LinkedHashMap will guarantee @@ -337,6 +338,11 @@ public class BasicDataSourceFactory impl dataSource.setDefaultCatalog(value); } + value = properties.getProperty(PROP_DEFAULTSCHEMA); + if (value != null) { + dataSource.setDefaultSchema(value); + } + value = properties.getProperty(PROP_CACHESTATE); if (value != null) { dataSource.setCacheState(Boolean.valueOf(value).booleanValue()); Modified: tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSourceMXBean.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSourceMXBean.java?rev=1837746&r1=1837745&r2=1837746&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSourceMXBean.java (original) +++ tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSourceMXBean.java Thu Aug 9 16:50:30 2018 @@ -59,6 +59,16 @@ public interface BasicDataSourceMXBean { String getDefaultCatalog(); /** + * See {@link BasicDataSource#getDefaultSchema()} + * + * @return {@link BasicDataSource#getDefaultSchema()} + * @since 2.5.0 + */ + default String getDefaultSchema() { + return null; + } + + /** * See {@link BasicDataSource#getCacheState()} * * @return {@link BasicDataSource#getCacheState()} Modified: tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/DelegatingCallableStatement.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/DelegatingCallableStatement.java?rev=1837746&r1=1837745&r2=1837746&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/DelegatingCallableStatement.java (original) +++ tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/DelegatingCallableStatement.java Thu Aug 9 16:50:30 2018 @@ -30,6 +30,7 @@ import java.sql.NClob; import java.sql.Ref; import java.sql.RowId; import java.sql.SQLException; +import java.sql.SQLType; import java.sql.SQLXML; import java.sql.Time; import java.sql.Timestamp; @@ -55,51 +56,55 @@ public class DelegatingCallableStatement * Creates a wrapper for the Statement which traces this Statement to the Connection which created it and the code * which created it. * - * @param c + * @param connection * the {@link DelegatingConnection} that created this statement - * @param s + * @param statement * the {@link CallableStatement} to delegate all calls to */ - public DelegatingCallableStatement(final DelegatingConnection<?> c, final CallableStatement s) { - super(c, s); + public DelegatingCallableStatement(final DelegatingConnection<?> connection, final CallableStatement statement) { + super(connection, statement); } @Override - public void registerOutParameter(final int parameterIndex, final int sqlType) throws SQLException { + public Array getArray(final int parameterIndex) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().registerOutParameter(parameterIndex, sqlType); + return getDelegateCallableStatement().getArray(parameterIndex); } catch (final SQLException e) { handleException(e); + return null; } } @Override - public void registerOutParameter(final int parameterIndex, final int sqlType, final int scale) throws SQLException { + public Array getArray(final String parameterName) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().registerOutParameter(parameterIndex, sqlType, scale); + return getDelegateCallableStatement().getArray(parameterName); } catch (final SQLException e) { handleException(e); + return null; } } @Override - public boolean wasNull() throws SQLException { + public BigDecimal getBigDecimal(final int parameterIndex) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().wasNull(); + return getDelegateCallableStatement().getBigDecimal(parameterIndex); } catch (final SQLException e) { handleException(e); - return false; + return null; } } + /** @deprecated Use {@link #getBigDecimal(int)} or {@link #getBigDecimal(String)} */ @Override - public String getString(final int parameterIndex) throws SQLException { + @Deprecated + public BigDecimal getBigDecimal(final int parameterIndex, final int scale) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getString(parameterIndex); + return getDelegateCallableStatement().getBigDecimal(parameterIndex, scale); } catch (final SQLException e) { handleException(e); return null; @@ -107,65 +112,65 @@ public class DelegatingCallableStatement } @Override - public boolean getBoolean(final int parameterIndex) throws SQLException { + public BigDecimal getBigDecimal(final String parameterName) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getBoolean(parameterIndex); + return getDelegateCallableStatement().getBigDecimal(parameterName); } catch (final SQLException e) { handleException(e); - return false; + return null; } } @Override - public byte getByte(final int parameterIndex) throws SQLException { + public Blob getBlob(final int parameterIndex) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getByte(parameterIndex); + return getDelegateCallableStatement().getBlob(parameterIndex); } catch (final SQLException e) { handleException(e); - return 0; + return null; } } @Override - public short getShort(final int parameterIndex) throws SQLException { + public Blob getBlob(final String parameterName) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getShort(parameterIndex); + return getDelegateCallableStatement().getBlob(parameterName); } catch (final SQLException e) { handleException(e); - return 0; + return null; } } @Override - public int getInt(final int parameterIndex) throws SQLException { + public boolean getBoolean(final int parameterIndex) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getInt(parameterIndex); + return getDelegateCallableStatement().getBoolean(parameterIndex); } catch (final SQLException e) { handleException(e); - return 0; + return false; } } @Override - public long getLong(final int parameterIndex) throws SQLException { + public boolean getBoolean(final String parameterName) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getLong(parameterIndex); + return getDelegateCallableStatement().getBoolean(parameterName); } catch (final SQLException e) { handleException(e); - return 0; + return false; } } @Override - public float getFloat(final int parameterIndex) throws SQLException { + public byte getByte(final int parameterIndex) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getFloat(parameterIndex); + return getDelegateCallableStatement().getByte(parameterIndex); } catch (final SQLException e) { handleException(e); return 0; @@ -173,23 +178,21 @@ public class DelegatingCallableStatement } @Override - public double getDouble(final int parameterIndex) throws SQLException { + public byte getByte(final String parameterName) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getDouble(parameterIndex); + return getDelegateCallableStatement().getByte(parameterName); } catch (final SQLException e) { handleException(e); return 0; } } - /** @deprecated Use {@link #getBigDecimal(int)} or {@link #getBigDecimal(String)} */ @Override - @Deprecated - public BigDecimal getBigDecimal(final int parameterIndex, final int scale) throws SQLException { + public byte[] getBytes(final int parameterIndex) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getBigDecimal(parameterIndex, scale); + return getDelegateCallableStatement().getBytes(parameterIndex); } catch (final SQLException e) { handleException(e); return null; @@ -197,10 +200,10 @@ public class DelegatingCallableStatement } @Override - public byte[] getBytes(final int parameterIndex) throws SQLException { + public byte[] getBytes(final String parameterName) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getBytes(parameterIndex); + return getDelegateCallableStatement().getBytes(parameterName); } catch (final SQLException e) { handleException(e); return null; @@ -208,10 +211,10 @@ public class DelegatingCallableStatement } @Override - public Date getDate(final int parameterIndex) throws SQLException { + public Reader getCharacterStream(final int parameterIndex) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getDate(parameterIndex); + return getDelegateCallableStatement().getCharacterStream(parameterIndex); } catch (final SQLException e) { handleException(e); return null; @@ -219,10 +222,10 @@ public class DelegatingCallableStatement } @Override - public Time getTime(final int parameterIndex) throws SQLException { + public Reader getCharacterStream(final String parameterName) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getTime(parameterIndex); + return getDelegateCallableStatement().getCharacterStream(parameterName); } catch (final SQLException e) { handleException(e); return null; @@ -230,10 +233,10 @@ public class DelegatingCallableStatement } @Override - public Timestamp getTimestamp(final int parameterIndex) throws SQLException { + public Clob getClob(final int parameterIndex) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getTimestamp(parameterIndex); + return getDelegateCallableStatement().getClob(parameterIndex); } catch (final SQLException e) { handleException(e); return null; @@ -241,10 +244,10 @@ public class DelegatingCallableStatement } @Override - public Object getObject(final int parameterIndex) throws SQLException { + public Clob getClob(final String parameterName) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getObject(parameterIndex); + return getDelegateCallableStatement().getClob(parameterName); } catch (final SQLException e) { handleException(e); return null; @@ -252,10 +255,10 @@ public class DelegatingCallableStatement } @Override - public BigDecimal getBigDecimal(final int parameterIndex) throws SQLException { + public Date getDate(final int parameterIndex) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getBigDecimal(parameterIndex); + return getDelegateCallableStatement().getDate(parameterIndex); } catch (final SQLException e) { handleException(e); return null; @@ -263,10 +266,10 @@ public class DelegatingCallableStatement } @Override - public Object getObject(final int i, final Map<String, Class<?>> map) throws SQLException { + public Date getDate(final int parameterIndex, final Calendar cal) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getObject(i, map); + return getDelegateCallableStatement().getDate(parameterIndex, cal); } catch (final SQLException e) { handleException(e); return null; @@ -274,10 +277,10 @@ public class DelegatingCallableStatement } @Override - public Ref getRef(final int i) throws SQLException { + public Date getDate(final String parameterName) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getRef(i); + return getDelegateCallableStatement().getDate(parameterName); } catch (final SQLException e) { handleException(e); return null; @@ -285,119 +288,124 @@ public class DelegatingCallableStatement } @Override - public Blob getBlob(final int i) throws SQLException { + public Date getDate(final String parameterName, final Calendar cal) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getBlob(i); + return getDelegateCallableStatement().getDate(parameterName, cal); } catch (final SQLException e) { handleException(e); return null; } } + private CallableStatement getDelegateCallableStatement() { + return (CallableStatement) getDelegate(); + } + @Override - public Clob getClob(final int i) throws SQLException { + public double getDouble(final int parameterIndex) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getClob(i); + return getDelegateCallableStatement().getDouble(parameterIndex); } catch (final SQLException e) { handleException(e); - return null; + return 0; } } @Override - public Array getArray(final int i) throws SQLException { + public double getDouble(final String parameterName) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getArray(i); + return getDelegateCallableStatement().getDouble(parameterName); } catch (final SQLException e) { handleException(e); - return null; + return 0; } } @Override - public Date getDate(final int parameterIndex, final Calendar cal) throws SQLException { + public float getFloat(final int parameterIndex) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getDate(parameterIndex, cal); + return getDelegateCallableStatement().getFloat(parameterIndex); } catch (final SQLException e) { handleException(e); - return null; + return 0; } } @Override - public Time getTime(final int parameterIndex, final Calendar cal) throws SQLException { + public float getFloat(final String parameterName) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getTime(parameterIndex, cal); + return getDelegateCallableStatement().getFloat(parameterName); } catch (final SQLException e) { handleException(e); - return null; + return 0; } } @Override - public Timestamp getTimestamp(final int parameterIndex, final Calendar cal) throws SQLException { + public int getInt(final int parameterIndex) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getTimestamp(parameterIndex, cal); + return getDelegateCallableStatement().getInt(parameterIndex); } catch (final SQLException e) { handleException(e); - return null; + return 0; } } @Override - public void registerOutParameter(final int paramIndex, final int sqlType, final String typeName) - throws SQLException { + public int getInt(final String parameterName) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().registerOutParameter(paramIndex, sqlType, typeName); + return getDelegateCallableStatement().getInt(parameterName); } catch (final SQLException e) { handleException(e); + return 0; } } @Override - public void registerOutParameter(final String parameterName, final int sqlType) throws SQLException { + public long getLong(final int parameterIndex) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().registerOutParameter(parameterName, sqlType); + return getDelegateCallableStatement().getLong(parameterIndex); } catch (final SQLException e) { handleException(e); + return 0; } } @Override - public void registerOutParameter(final String parameterName, final int sqlType, final int scale) - throws SQLException { + public long getLong(final String parameterName) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().registerOutParameter(parameterName, sqlType, scale); + return getDelegateCallableStatement().getLong(parameterName); } catch (final SQLException e) { handleException(e); + return 0; } } @Override - public void registerOutParameter(final String parameterName, final int sqlType, final String typeName) - throws SQLException { + public Reader getNCharacterStream(final int parameterIndex) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().registerOutParameter(parameterName, sqlType, typeName); + return getDelegateCallableStatement().getNCharacterStream(parameterIndex); } catch (final SQLException e) { handleException(e); + return null; } } @Override - public URL getURL(final int parameterIndex) throws SQLException { + public Reader getNCharacterStream(final String parameterName) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getURL(parameterIndex); + return getDelegateCallableStatement().getNCharacterStream(parameterName); } catch (final SQLException e) { handleException(e); return null; @@ -405,258 +413,285 @@ public class DelegatingCallableStatement } @Override - public void setURL(final String parameterName, final URL val) throws SQLException { + public NClob getNClob(final int parameterIndex) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setURL(parameterName, val); + return getDelegateCallableStatement().getNClob(parameterIndex); } catch (final SQLException e) { handleException(e); + return null; } } @Override - public void setNull(final String parameterName, final int sqlType) throws SQLException { + public NClob getNClob(final String parameterName) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setNull(parameterName, sqlType); + return getDelegateCallableStatement().getNClob(parameterName); } catch (final SQLException e) { handleException(e); + return null; } } @Override - public void setBoolean(final String parameterName, final boolean x) throws SQLException { + public String getNString(final int parameterIndex) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setBoolean(parameterName, x); + return getDelegateCallableStatement().getNString(parameterIndex); } catch (final SQLException e) { handleException(e); + return null; } } @Override - public void setByte(final String parameterName, final byte x) throws SQLException { + public String getNString(final String parameterName) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setByte(parameterName, x); + return getDelegateCallableStatement().getNString(parameterName); } catch (final SQLException e) { handleException(e); + return null; } } @Override - public void setShort(final String parameterName, final short x) throws SQLException { + public Object getObject(final int parameterIndex) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setShort(parameterName, x); + return getDelegateCallableStatement().getObject(parameterIndex); } catch (final SQLException e) { handleException(e); + return null; } } @Override - public void setInt(final String parameterName, final int x) throws SQLException { + public <T> T getObject(final int parameterIndex, final Class<T> type) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setInt(parameterName, x); + return getDelegateCallableStatement().getObject(parameterIndex, type); } catch (final SQLException e) { handleException(e); + return null; } } @Override - public void setLong(final String parameterName, final long x) throws SQLException { + public Object getObject(final int i, final Map<String, Class<?>> map) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setLong(parameterName, x); + return getDelegateCallableStatement().getObject(i, map); } catch (final SQLException e) { handleException(e); + return null; } } @Override - public void setFloat(final String parameterName, final float x) throws SQLException { + public Object getObject(final String parameterName) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setFloat(parameterName, x); + return getDelegateCallableStatement().getObject(parameterName); } catch (final SQLException e) { handleException(e); + return null; } } @Override - public void setDouble(final String parameterName, final double x) throws SQLException { + public <T> T getObject(final String parameterName, final Class<T> type) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setDouble(parameterName, x); + return getDelegateCallableStatement().getObject(parameterName, type); } catch (final SQLException e) { handleException(e); + return null; } } @Override - public void setBigDecimal(final String parameterName, final BigDecimal x) throws SQLException { + public Object getObject(final String parameterName, final Map<String, Class<?>> map) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setBigDecimal(parameterName, x); + return getDelegateCallableStatement().getObject(parameterName, map); } catch (final SQLException e) { handleException(e); + return null; } } @Override - public void setString(final String parameterName, final String x) throws SQLException { + public Ref getRef(final int parameterIndex) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setString(parameterName, x); + return getDelegateCallableStatement().getRef(parameterIndex); } catch (final SQLException e) { handleException(e); + return null; } } @Override - public void setBytes(final String parameterName, final byte[] x) throws SQLException { + public Ref getRef(final String parameterName) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setBytes(parameterName, x); + return getDelegateCallableStatement().getRef(parameterName); } catch (final SQLException e) { handleException(e); + return null; } } @Override - public void setDate(final String parameterName, final Date x) throws SQLException { + public RowId getRowId(final int parameterIndex) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setDate(parameterName, x); + return getDelegateCallableStatement().getRowId(parameterIndex); } catch (final SQLException e) { handleException(e); + return null; } } @Override - public void setTime(final String parameterName, final Time x) throws SQLException { + public RowId getRowId(final String parameterName) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setTime(parameterName, x); + return getDelegateCallableStatement().getRowId(parameterName); } catch (final SQLException e) { handleException(e); + return null; } } @Override - public void setTimestamp(final String parameterName, final Timestamp x) throws SQLException { + public short getShort(final int parameterIndex) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setTimestamp(parameterName, x); + return getDelegateCallableStatement().getShort(parameterIndex); } catch (final SQLException e) { handleException(e); + return 0; } } @Override - public void setAsciiStream(final String parameterName, final InputStream x, final int length) throws SQLException { + public short getShort(final String parameterName) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setAsciiStream(parameterName, x, length); + return getDelegateCallableStatement().getShort(parameterName); } catch (final SQLException e) { handleException(e); + return 0; } } @Override - public void setBinaryStream(final String parameterName, final InputStream x, final int length) throws SQLException { + public SQLXML getSQLXML(final int parameterIndex) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setBinaryStream(parameterName, x, length); + return getDelegateCallableStatement().getSQLXML(parameterIndex); } catch (final SQLException e) { handleException(e); + return null; } } @Override - public void setObject(final String parameterName, final Object x, final int targetSqlType, final int scale) - throws SQLException { + public SQLXML getSQLXML(final String parameterName) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setObject(parameterName, x, targetSqlType, scale); + return getDelegateCallableStatement().getSQLXML(parameterName); } catch (final SQLException e) { handleException(e); + return null; } } @Override - public void setObject(final String parameterName, final Object x, final int targetSqlType) throws SQLException { + public String getString(final int parameterIndex) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setObject(parameterName, x, targetSqlType); + return getDelegateCallableStatement().getString(parameterIndex); } catch (final SQLException e) { handleException(e); + return null; } } @Override - public void setObject(final String parameterName, final Object x) throws SQLException { + public String getString(final String parameterName) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setObject(parameterName, x); + return getDelegateCallableStatement().getString(parameterName); } catch (final SQLException e) { handleException(e); + return null; } } @Override - public void setCharacterStream(final String parameterName, final Reader reader, final int length) - throws SQLException { + public Time getTime(final int parameterIndex) throws SQLException { checkOpen(); - getDelegateCallableStatement().setCharacterStream(parameterName, reader, length); - } - - @Override - public void setDate(final String parameterName, final Date x, final Calendar cal) throws SQLException { + try { + return getDelegateCallableStatement().getTime(parameterIndex); + } catch (final SQLException e) { + handleException(e); + return null; + } + } + + @Override + public Time getTime(final int parameterIndex, final Calendar cal) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setDate(parameterName, x, cal); + return getDelegateCallableStatement().getTime(parameterIndex, cal); } catch (final SQLException e) { handleException(e); + return null; } } @Override - public void setTime(final String parameterName, final Time x, final Calendar cal) throws SQLException { + public Time getTime(final String parameterName) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setTime(parameterName, x, cal); + return getDelegateCallableStatement().getTime(parameterName); } catch (final SQLException e) { handleException(e); + return null; } } @Override - public void setTimestamp(final String parameterName, final Timestamp x, final Calendar cal) throws SQLException { + public Time getTime(final String parameterName, final Calendar cal) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setTimestamp(parameterName, x, cal); + return getDelegateCallableStatement().getTime(parameterName, cal); } catch (final SQLException e) { handleException(e); + return null; } } @Override - public void setNull(final String parameterName, final int sqlType, final String typeName) throws SQLException { + public Timestamp getTimestamp(final int parameterIndex) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setNull(parameterName, sqlType, typeName); + return getDelegateCallableStatement().getTimestamp(parameterIndex); } catch (final SQLException e) { handleException(e); + return null; } } @Override - public String getString(final String parameterName) throws SQLException { + public Timestamp getTimestamp(final int parameterIndex, final Calendar cal) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getString(parameterName); + return getDelegateCallableStatement().getTimestamp(parameterIndex, cal); } catch (final SQLException e) { handleException(e); return null; @@ -664,309 +699,370 @@ public class DelegatingCallableStatement } @Override - public boolean getBoolean(final String parameterName) throws SQLException { + public Timestamp getTimestamp(final String parameterName) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getBoolean(parameterName); + return getDelegateCallableStatement().getTimestamp(parameterName); } catch (final SQLException e) { handleException(e); - return false; + return null; } } @Override - public byte getByte(final String parameterName) throws SQLException { + public Timestamp getTimestamp(final String parameterName, final Calendar cal) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getByte(parameterName); + return getDelegateCallableStatement().getTimestamp(parameterName, cal); } catch (final SQLException e) { handleException(e); - return 0; + return null; } } @Override - public short getShort(final String parameterName) throws SQLException { + public URL getURL(final int parameterIndex) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getShort(parameterName); + return getDelegateCallableStatement().getURL(parameterIndex); } catch (final SQLException e) { handleException(e); - return 0; + return null; } } @Override - public int getInt(final String parameterName) throws SQLException { + public URL getURL(final String parameterName) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getInt(parameterName); + return getDelegateCallableStatement().getURL(parameterName); } catch (final SQLException e) { handleException(e); - return 0; + return null; } } @Override - public long getLong(final String parameterName) throws SQLException { + public void registerOutParameter(final int parameterIndex, final int sqlType) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getLong(parameterName); + getDelegateCallableStatement().registerOutParameter(parameterIndex, sqlType); } catch (final SQLException e) { handleException(e); - return 0; } } @Override - public float getFloat(final String parameterName) throws SQLException { + public void registerOutParameter(final int parameterIndex, final int sqlType, final int scale) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getFloat(parameterName); + getDelegateCallableStatement().registerOutParameter(parameterIndex, sqlType, scale); } catch (final SQLException e) { handleException(e); - return 0; } } @Override - public double getDouble(final String parameterName) throws SQLException { + public void registerOutParameter(final int paramIndex, final int sqlType, final String typeName) + throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getDouble(parameterName); + getDelegateCallableStatement().registerOutParameter(paramIndex, sqlType, typeName); } catch (final SQLException e) { handleException(e); - return 0; } } + /** + * @since 2.5.0 + */ @Override - public byte[] getBytes(final String parameterName) throws SQLException { + public void registerOutParameter(final int parameterIndex, final SQLType sqlType) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getBytes(parameterName); + getDelegateCallableStatement().registerOutParameter(parameterIndex, sqlType); } catch (final SQLException e) { handleException(e); - return null; } } + /** + * @since 2.5.0 + */ @Override - public Date getDate(final String parameterName) throws SQLException { + public void registerOutParameter(final int parameterIndex, final SQLType sqlType, final int scale) + throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getDate(parameterName); + getDelegateCallableStatement().registerOutParameter(parameterIndex, sqlType, scale); } catch (final SQLException e) { handleException(e); - return null; } } + /** + * @since 2.5.0 + */ @Override - public Time getTime(final String parameterName) throws SQLException { + public void registerOutParameter(final int parameterIndex, final SQLType sqlType, final String typeName) + throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getTime(parameterName); + getDelegateCallableStatement().registerOutParameter(parameterIndex, sqlType, typeName); } catch (final SQLException e) { handleException(e); - return null; } } @Override - public Timestamp getTimestamp(final String parameterName) throws SQLException { + public void registerOutParameter(final String parameterName, final int sqlType) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getTimestamp(parameterName); + getDelegateCallableStatement().registerOutParameter(parameterName, sqlType); } catch (final SQLException e) { handleException(e); - return null; } } @Override - public Object getObject(final String parameterName) throws SQLException { + public void registerOutParameter(final String parameterName, final int sqlType, final int scale) + throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getObject(parameterName); + getDelegateCallableStatement().registerOutParameter(parameterName, sqlType, scale); } catch (final SQLException e) { handleException(e); - return null; } } @Override - public BigDecimal getBigDecimal(final String parameterName) throws SQLException { + public void registerOutParameter(final String parameterName, final int sqlType, final String typeName) + throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getBigDecimal(parameterName); + getDelegateCallableStatement().registerOutParameter(parameterName, sqlType, typeName); } catch (final SQLException e) { handleException(e); - return null; } } + /** + * @since 2.5.0 + */ @Override - public Object getObject(final String parameterName, final Map<String, Class<?>> map) throws SQLException { + public void registerOutParameter(final String parameterName, final SQLType sqlType) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getObject(parameterName, map); + getDelegateCallableStatement().registerOutParameter(parameterName, sqlType); } catch (final SQLException e) { handleException(e); - return null; } } + /** + * @since 2.5.0 + */ @Override - public Ref getRef(final String parameterName) throws SQLException { + public void registerOutParameter(final String parameterName, final SQLType sqlType, final int scale) + throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getRef(parameterName); + getDelegateCallableStatement().registerOutParameter(parameterName, sqlType, scale); } catch (final SQLException e) { handleException(e); - return null; } } + /** + * @since 2.5.0 + */ @Override - public Blob getBlob(final String parameterName) throws SQLException { + public void registerOutParameter(final String parameterName, final SQLType sqlType, final String typeName) + throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getBlob(parameterName); + getDelegateCallableStatement().registerOutParameter(parameterName, sqlType, typeName); } catch (final SQLException e) { handleException(e); - return null; } } @Override - public Clob getClob(final String parameterName) throws SQLException { + public void setAsciiStream(final String parameterName, final InputStream inputStream) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getClob(parameterName); + getDelegateCallableStatement().setAsciiStream(parameterName, inputStream); } catch (final SQLException e) { handleException(e); - return null; } } @Override - public Array getArray(final String parameterName) throws SQLException { + public void setAsciiStream(final String parameterName, final InputStream x, final int length) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getArray(parameterName); + getDelegateCallableStatement().setAsciiStream(parameterName, x, length); } catch (final SQLException e) { handleException(e); - return null; } } @Override - public Date getDate(final String parameterName, final Calendar cal) throws SQLException { + public void setAsciiStream(final String parameterName, final InputStream inputStream, final long length) + throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getDate(parameterName, cal); + getDelegateCallableStatement().setAsciiStream(parameterName, inputStream, length); } catch (final SQLException e) { handleException(e); - return null; } } - private CallableStatement getDelegateCallableStatement() { - return (CallableStatement) getDelegate(); + @Override + public void setBigDecimal(final String parameterName, final BigDecimal x) throws SQLException { + checkOpen(); + try { + getDelegateCallableStatement().setBigDecimal(parameterName, x); + } catch (final SQLException e) { + handleException(e); + } } @Override - public Time getTime(final String parameterName, final Calendar cal) throws SQLException { + public void setBinaryStream(final String parameterName, final InputStream inputStream) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getTime(parameterName, cal); + getDelegateCallableStatement().setBinaryStream(parameterName, inputStream); } catch (final SQLException e) { handleException(e); - return null; } } @Override - public Timestamp getTimestamp(final String parameterName, final Calendar cal) throws SQLException { + public void setBinaryStream(final String parameterName, final InputStream x, final int length) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getTimestamp(parameterName, cal); + getDelegateCallableStatement().setBinaryStream(parameterName, x, length); } catch (final SQLException e) { handleException(e); - return null; } } @Override - public URL getURL(final String parameterName) throws SQLException { + public void setBinaryStream(final String parameterName, final InputStream inputStream, final long length) + throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getURL(parameterName); + getDelegateCallableStatement().setBinaryStream(parameterName, inputStream, length); } catch (final SQLException e) { handleException(e); - return null; } } @Override - public RowId getRowId(final int parameterIndex) throws SQLException { + public void setBlob(final String parameterName, final Blob blob) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getRowId(parameterIndex); + getDelegateCallableStatement().setBlob(parameterName, blob); } catch (final SQLException e) { handleException(e); - return null; } } @Override - public RowId getRowId(final String parameterName) throws SQLException { + public void setBlob(final String parameterName, final InputStream inputStream) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getRowId(parameterName); + getDelegateCallableStatement().setBlob(parameterName, inputStream); } catch (final SQLException e) { handleException(e); - return null; } } @Override - public void setRowId(final String parameterName, final RowId value) throws SQLException { + public void setBlob(final String parameterName, final InputStream inputStream, final long length) + throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setRowId(parameterName, value); + getDelegateCallableStatement().setBlob(parameterName, inputStream, length); } catch (final SQLException e) { handleException(e); } } @Override - public void setNString(final String parameterName, final String value) throws SQLException { + public void setBoolean(final String parameterName, final boolean x) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setNString(parameterName, value); + getDelegateCallableStatement().setBoolean(parameterName, x); } catch (final SQLException e) { handleException(e); } } @Override - public void setNCharacterStream(final String parameterName, final Reader reader, final long length) + public void setByte(final String parameterName, final byte x) throws SQLException { + checkOpen(); + try { + getDelegateCallableStatement().setByte(parameterName, x); + } catch (final SQLException e) { + handleException(e); + } + } + + @Override + public void setBytes(final String parameterName, final byte[] x) throws SQLException { + checkOpen(); + try { + getDelegateCallableStatement().setBytes(parameterName, x); + } catch (final SQLException e) { + handleException(e); + } + } + + @Override + public void setCharacterStream(final String parameterName, final Reader reader) throws SQLException { + checkOpen(); + try { + getDelegateCallableStatement().setCharacterStream(parameterName, reader); + } catch (final SQLException e) { + handleException(e); + } + } + + @Override + public void setCharacterStream(final String parameterName, final Reader reader, final int length) + throws SQLException { + checkOpen(); + getDelegateCallableStatement().setCharacterStream(parameterName, reader, length); + } + + @Override + public void setCharacterStream(final String parameterName, final Reader reader, final long length) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setNCharacterStream(parameterName, reader, length); + getDelegateCallableStatement().setCharacterStream(parameterName, reader, length); } catch (final SQLException e) { handleException(e); } } @Override - public void setNClob(final String parameterName, final NClob value) throws SQLException { + public void setClob(final String parameterName, final Clob clob) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setNClob(parameterName, value); + getDelegateCallableStatement().setClob(parameterName, clob); + } catch (final SQLException e) { + handleException(e); + } + } + + @Override + public void setClob(final String parameterName, final Reader reader) throws SQLException { + checkOpen(); + try { + getDelegateCallableStatement().setClob(parameterName, reader); } catch (final SQLException e) { handleException(e); } @@ -983,288 +1079,302 @@ public class DelegatingCallableStatement } @Override - public void setBlob(final String parameterName, final InputStream inputStream, final long length) - throws SQLException { + public void setDate(final String parameterName, final Date x) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setBlob(parameterName, inputStream, length); + getDelegateCallableStatement().setDate(parameterName, x); } catch (final SQLException e) { handleException(e); } } @Override - public void setNClob(final String parameterName, final Reader reader, final long length) throws SQLException { + public void setDate(final String parameterName, final Date x, final Calendar cal) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setNClob(parameterName, reader, length); + getDelegateCallableStatement().setDate(parameterName, x, cal); } catch (final SQLException e) { handleException(e); } } @Override - public NClob getNClob(final int parameterIndex) throws SQLException { + public void setDouble(final String parameterName, final double x) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getNClob(parameterIndex); + getDelegateCallableStatement().setDouble(parameterName, x); } catch (final SQLException e) { handleException(e); - return null; } } @Override - public NClob getNClob(final String parameterName) throws SQLException { + public void setFloat(final String parameterName, final float x) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getNClob(parameterName); + getDelegateCallableStatement().setFloat(parameterName, x); } catch (final SQLException e) { handleException(e); - return null; } } @Override - public void setSQLXML(final String parameterName, final SQLXML value) throws SQLException { + public void setInt(final String parameterName, final int x) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setSQLXML(parameterName, value); + getDelegateCallableStatement().setInt(parameterName, x); } catch (final SQLException e) { handleException(e); } } @Override - public SQLXML getSQLXML(final int parameterIndex) throws SQLException { + public void setLong(final String parameterName, final long x) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getSQLXML(parameterIndex); + getDelegateCallableStatement().setLong(parameterName, x); } catch (final SQLException e) { handleException(e); - return null; } } @Override - public SQLXML getSQLXML(final String parameterName) throws SQLException { + public void setNCharacterStream(final String parameterName, final Reader reader) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getSQLXML(parameterName); + getDelegateCallableStatement().setNCharacterStream(parameterName, reader); } catch (final SQLException e) { handleException(e); - return null; } } @Override - public String getNString(final int parameterIndex) throws SQLException { + public void setNCharacterStream(final String parameterName, final Reader reader, final long length) + throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getNString(parameterIndex); + getDelegateCallableStatement().setNCharacterStream(parameterName, reader, length); } catch (final SQLException e) { handleException(e); - return null; } } @Override - public String getNString(final String parameterName) throws SQLException { + public void setNClob(final String parameterName, final NClob value) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getNString(parameterName); + getDelegateCallableStatement().setNClob(parameterName, value); } catch (final SQLException e) { handleException(e); - return null; } } @Override - public Reader getNCharacterStream(final int parameterIndex) throws SQLException { + public void setNClob(final String parameterName, final Reader reader) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getNCharacterStream(parameterIndex); + getDelegateCallableStatement().setNClob(parameterName, reader); } catch (final SQLException e) { handleException(e); - return null; } } @Override - public Reader getNCharacterStream(final String parameterName) throws SQLException { + public void setNClob(final String parameterName, final Reader reader, final long length) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getNCharacterStream(parameterName); + getDelegateCallableStatement().setNClob(parameterName, reader, length); } catch (final SQLException e) { handleException(e); - return null; } } @Override - public Reader getCharacterStream(final int parameterIndex) throws SQLException { + public void setNString(final String parameterName, final String value) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getCharacterStream(parameterIndex); + getDelegateCallableStatement().setNString(parameterName, value); } catch (final SQLException e) { handleException(e); - return null; } } @Override - public Reader getCharacterStream(final String parameterName) throws SQLException { + public void setNull(final String parameterName, final int sqlType) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getCharacterStream(parameterName); + getDelegateCallableStatement().setNull(parameterName, sqlType); } catch (final SQLException e) { handleException(e); - return null; } } @Override - public void setBlob(final String parameterName, final Blob blob) throws SQLException { + public void setNull(final String parameterName, final int sqlType, final String typeName) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setBlob(parameterName, blob); + getDelegateCallableStatement().setNull(parameterName, sqlType, typeName); } catch (final SQLException e) { handleException(e); } } @Override - public void setClob(final String parameterName, final Clob clob) throws SQLException { + public void setObject(final String parameterName, final Object x) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setClob(parameterName, clob); + getDelegateCallableStatement().setObject(parameterName, x); } catch (final SQLException e) { handleException(e); } } @Override - public void setAsciiStream(final String parameterName, final InputStream inputStream, final long length) - throws SQLException { + public void setObject(final String parameterName, final Object x, final int targetSqlType) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setAsciiStream(parameterName, inputStream, length); + getDelegateCallableStatement().setObject(parameterName, x, targetSqlType); } catch (final SQLException e) { handleException(e); } } @Override - public void setBinaryStream(final String parameterName, final InputStream inputStream, final long length) + public void setObject(final String parameterName, final Object x, final int targetSqlType, final int scale) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setBinaryStream(parameterName, inputStream, length); + getDelegateCallableStatement().setObject(parameterName, x, targetSqlType, scale); } catch (final SQLException e) { handleException(e); } } + /** + * @since 2.5.0 + */ @Override - public void setCharacterStream(final String parameterName, final Reader reader, final long length) - throws SQLException { + public void setObject(final String parameterName, final Object x, final SQLType targetSqlType) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setCharacterStream(parameterName, reader, length); + getDelegateCallableStatement().setObject(parameterName, x, targetSqlType); } catch (final SQLException e) { handleException(e); } } + /** + * @since 2.5.0 + */ @Override - public void setAsciiStream(final String parameterName, final InputStream inputStream) throws SQLException { + public void setObject(final String parameterName, final Object x, final SQLType targetSqlType, + final int scaleOrLength) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setAsciiStream(parameterName, inputStream); + getDelegateCallableStatement().setObject(parameterName, x, targetSqlType, scaleOrLength); } catch (final SQLException e) { handleException(e); } } @Override - public void setBinaryStream(final String parameterName, final InputStream inputStream) throws SQLException { + public void setRowId(final String parameterName, final RowId value) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setBinaryStream(parameterName, inputStream); + getDelegateCallableStatement().setRowId(parameterName, value); } catch (final SQLException e) { handleException(e); } } @Override - public void setCharacterStream(final String parameterName, final Reader reader) throws SQLException { + public void setShort(final String parameterName, final short x) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setCharacterStream(parameterName, reader); + getDelegateCallableStatement().setShort(parameterName, x); } catch (final SQLException e) { handleException(e); } } @Override - public void setNCharacterStream(final String parameterName, final Reader reader) throws SQLException { + public void setSQLXML(final String parameterName, final SQLXML value) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setNCharacterStream(parameterName, reader); + getDelegateCallableStatement().setSQLXML(parameterName, value); } catch (final SQLException e) { handleException(e); } } @Override - public void setClob(final String parameterName, final Reader reader) throws SQLException { + public void setString(final String parameterName, final String x) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setClob(parameterName, reader); + getDelegateCallableStatement().setString(parameterName, x); } catch (final SQLException e) { handleException(e); } } @Override - public void setBlob(final String parameterName, final InputStream inputStream) throws SQLException { + public void setTime(final String parameterName, final Time x) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setBlob(parameterName, inputStream); + getDelegateCallableStatement().setTime(parameterName, x); } catch (final SQLException e) { handleException(e); } } @Override - public void setNClob(final String parameterName, final Reader reader) throws SQLException { + public void setTime(final String parameterName, final Time x, final Calendar cal) throws SQLException { checkOpen(); try { - getDelegateCallableStatement().setNClob(parameterName, reader); + getDelegateCallableStatement().setTime(parameterName, x, cal); } catch (final SQLException e) { handleException(e); } } @Override - public <T> T getObject(final int parameterIndex, final Class<T> type) throws SQLException { + public void setTimestamp(final String parameterName, final Timestamp x) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getObject(parameterIndex, type); + getDelegateCallableStatement().setTimestamp(parameterName, x); } catch (final SQLException e) { handleException(e); - return null; } } @Override - public <T> T getObject(final String parameterName, final Class<T> type) throws SQLException { + public void setTimestamp(final String parameterName, final Timestamp x, final Calendar cal) throws SQLException { checkOpen(); try { - return getDelegateCallableStatement().getObject(parameterName, type); + getDelegateCallableStatement().setTimestamp(parameterName, x, cal); } catch (final SQLException e) { handleException(e); - return null; + } + } + + @Override + public void setURL(final String parameterName, final URL val) throws SQLException { + checkOpen(); + try { + getDelegateCallableStatement().setURL(parameterName, val); + } catch (final SQLException e) { + handleException(e); + } + } + + @Override + public boolean wasNull() throws SQLException { + checkOpen(); + try { + return getDelegateCallableStatement().wasNull(); + } catch (final SQLException e) { + handleException(e); + return false; } } Modified: tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/DelegatingConnection.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/DelegatingConnection.java?rev=1837746&r1=1837745&r2=1837746&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/DelegatingConnection.java (original) +++ tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/DelegatingConnection.java Thu Aug 9 16:50:30 2018 @@ -224,8 +224,20 @@ public class DelegatingConnection<C exte passivate(); } finally { if (connection != null) { + boolean connectionIsClosed; try { - connection.close(); + connectionIsClosed = connection.isClosed(); + } catch (final SQLException e) { + // not sure what the state is, so assume the connection is open. + connectionIsClosed = false; + } + try { + // DBCP-512: Avoid exceptions when closing a connection in mutli-threaded use case. + // Avoid closing again, which should be a no-op, but some drivers like H2 throw an exception when + // closing from multiple threads. + if (!connectionIsClosed) { + connection.close(); + } } finally { closed = true; } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org