This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-dbcp.git
The following commit(s) were added to refs/heads/master by this push: new fa10cfd Seems a trivial change to me, should I create a Jira? (#30) fa10cfd is described below commit fa10cfda08c3e12c5c187c1880f52f89284eb0e6 Author: Jacques Le Roux <jacques.le.r...@les7arts.com> AuthorDate: Thu Feb 28 14:52:08 2019 +0100 Seems a trivial change to me, should I create a Jira? (#30) * In OFBiz we implemented DebugManagedDataSource http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/connection/DebugManagedDataSource.java?view=markup We had to write DebugManagedDataSource::close in order to avoid throwing an InterruptedException ‘ManagedDataSource’ should declare more specific exceptions than ‘Exception’ for the ‘close’ method to allow the compiler to check that no ‘InterruptedException’ are thrown. * In OFBiz we implemented DebugManagedDataSource http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/connection/DebugManagedDataSource.java?view=markup We had to write DebugManagedDataSource::close in order to avoid throwing an InterruptedException ‘ManagedDataSource’ should declare more specific exceptions than ‘Exception’ for the ‘close’ method to allow the compiler to check that no ‘InterruptedException’ are thrown. * Updates changes.xml for DBCP-539 "ManagedDataSource::close should declare used exceptions" --- src/changes/changes.xml | 91 +++++++++++----------- .../apache/commons/dbcp2/PoolingDataSource.java | 2 +- 2 files changed, 48 insertions(+), 45 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index ff21ec3..c7dee60 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -20,13 +20,13 @@ This file is used by the maven-changes-plugin to generate the release notes. Useful ways of finding items to add to this file are: -1. Add items when you fix a bug or add a feature (this makes the +1. Add items when you fix a bug or add a feature (this makes the release process easy :-). 2. Do a bugzilla search for tickets closed since the previous release. 3. Use the report generated by the maven-changelog-plugin to see all -SVN commits. Set the project.properties' maven.changelog.range +SVN commits. Set the project.properties' maven.changelog.range property to the number of days since the last release. To generate the release notes from this file: @@ -61,6 +61,9 @@ The <action> type attribute can be add,update,fix,remove. <body> <release version="2.6.0" date="2019-02-14" description="This is a minor release, including bug fixes and enhancements."> + <action dev="jleroux" type="add" issue="DBCP-539" due-to="Jacques Le Roux"> + ManagedDataSource::close should declare used exceptions + </action> <action dev="chtompki" type="add" issue="DBCP-534" due-to="Peter Wicks"> Allow for manual connection eviction. </action> @@ -182,10 +185,10 @@ The <action> type attribute can be add,update,fix,remove. Add API org.apache.commons.dbcp2.datasources.PerUserPoolDataSource.clear(). </action> <action dev="ggregory" type="update" issue="DBCP-488" due-to="Gary Gregory"> - NPE for org.apache.commons.dbcp2.cpdsadapter.DriverAdapterCPDS.setConnectionProperties(null). + NPE for org.apache.commons.dbcp2.cpdsadapter.DriverAdapterCPDS.setConnectionProperties(null). </action> <action dev="ggregory" type="update" issue="DBCP-490" due-to="Gary Gregory"> - The method org.apache.commons.dbcp2.PoolingDriver.getConnectionPool(String) does not tell you which pool name is not registered when it throws an exception. + The method org.apache.commons.dbcp2.PoolingDriver.getConnectionPool(String) does not tell you which pool name is not registered when it throws an exception. </action> </release> <release version="2.2.0" date="2017-12-27" description="This is a minor release, including bug fixes and enhancements."> @@ -201,7 +204,7 @@ The <action> type attribute can be add,update,fix,remove. <action dev="psteitz" type="fix" issue="DBCP-452"> Add jmxName to properties set by BasicDataSourceFactory. This enables container-managed pools created from JNDI Resource - definitions to enable JMX by supplying a valid root JMX name. + definitions to enable JMX by supplying a valid root JMX name. </action> <action dev="ggregory" type="fix" issue="DBCP-446" due-to="Gary Gregory, feng yang, Euclides M, Phil Steitz"> NullPointerException thrown when calling ManagedConnection.isClosed(). @@ -258,7 +261,7 @@ The <action> type attribute can be add,update,fix,remove. <action dev="markt" type="fix" issue="DBCP-457"> When using a BasicDataSource, pass changes related to the handling of abandoned connections to the underlying pool so that the pool - configuration may be updated dynamically. + configuration may be updated dynamically. </action> <action dev="markt" type="add" issue="DBCP-474" due-to="Keiichi Fujino"> Enable pooling of all prepared and callable statements @@ -281,7 +284,7 @@ The <action> type attribute can be add,update,fix,remove. a null validation query. </action> <action issue="DBCP-438" dev="psteitz" type="fix" due-to="Raihan Kibria"> - Nested connections in a transaction (local) throws null pointer. + Nested connections in a transaction (local) throws null pointer. </action> <action issue="DBCP-437" dev="psteitz" type="fix"> BasicDataSource does not set disconnectionSql properties on its PoolableConnectionFactory. @@ -302,7 +305,7 @@ The <action> type attribute can be add,update,fix,remove. </action> <action dev="markt" type="fix"> Correct some Javadoc references to Apache Commons Pool 2 classes that - have changed names since Pool 1.x. + have changed names since Pool 1.x. </action> <action dev="markt" type="fix"> Do not ignore the configured custom eviction policy when creating a @@ -329,7 +332,7 @@ The <action> type attribute can be add,update,fix,remove. <action issue="DBCP-432" dev="psteitz" type="fix"> Changed BasicDataSource createDataSource method to ensure that initialization completes before clients get reference to newly created instances. - </action> + </action> <action issue="DBCP-433" dev="psteitz" type="fix" due-to="Vladimir Konkov"> Fixed connection leak when SQLException is thrown while enlisting an XA transaction. @@ -369,7 +372,7 @@ The <action> type attribute can be add,update,fix,remove. <release version="2.0" date="3 March 2014" description= "This release includes new features as well as bug fixes and enhancements. Version 2.0.x supports JDBC 4.1, so requires Java 7. - + The Java package name has been changed from 'org.apache.commons.dbcp' to 'org.apache.commons.dbcp2'. Also the Maven groupId is now 'org.apache.commons' and the artifactId is 'commons-dbcp2' These changes are necessary because the API is not strictly binary compatible with the 1.x releases. @@ -416,7 +419,7 @@ The <action> type attribute can be add,update,fix,remove. Removed JOCL support. </action> <action dev="markt" issue="DBCP-143" type="update"> - Remove deprecated SQLNestedException. + Remove deprecated SQLNestedException. </action> <action dev="markt" issue="DBCP-384" type="fix"> Fix threading issues with accessToUnderlyingConnectionAllowed attribute @@ -429,7 +432,7 @@ The <action> type attribute can be add,update,fix,remove. </action> <action dev="markt" issue="DBCP-376" type="fix" due-to="Dave Oxley"> Fix thread safety issues in the SharedPoolDataSource and the - PerUserPoolDataSource. + PerUserPoolDataSource. </action> <action dev="markt" issue="DBCP-382" type="fix" due-to="Stefan Rempfer"> Allow accessToUnderlyingConnectionAllowed to be configured when @@ -485,7 +488,7 @@ The <action> type attribute can be add,update,fix,remove. now taken from the JDBC driver. No calls to setReadOnly(), setAutoCommit() or setTransactionIsolation() will be made for a newly borrowed connection unless a default is explicitly configured and the - connection is currently using a different setting. + connection is currently using a different setting. </action> <action dev="markt" issue="DBCP-219" type="add"> Register pooled connections with JMX so that they may be forcibly closed @@ -495,7 +498,7 @@ The <action> type attribute can be add,update,fix,remove. Modify SharedPoolDataSource and PerUserPoolDataSource to expose all of the configuration properties of the underlying connection pool(s). This represents a significant refactoring of these classes and a number of - property names have changed as a result. + property names have changed as a result. </action> <action dev="markt" issue="DBCP-351" type="add"> Provide an option to control if autoCommit is always set to true when a @@ -572,7 +575,7 @@ The <action> type attribute can be add,update,fix,remove. is returned to the pool. </action> <action dev="markt" issue="DBCP-309" type="fix"> - Improve documentation for JNDI example using BasicDataSource. + Improve documentation for JNDI example using BasicDataSource. </action> </release> <release version="1.4.1" date="not yet released" description="TBD"> @@ -628,7 +631,7 @@ The <action> type attribute can be add,update,fix,remove. <release version="1.4" date="2010-02-14" description="This release includes new features as well as bug fixes and enhancements. Some bug fixes change semantics (e.g. connection close is now idempotent). The 1.3 - and 1.4 releases of DBCP are built from the same sources. Version 1.4 + and 1.4 releases of DBCP are built from the same sources. Version 1.4 supports JDBC 4, so requires JDK 1.6. Applications running under JDK 1.4-1.5 must use DBCP 1.3. Applications running under JDK 1.6 should use DBCP 1.4. Other than support for the added methods in JDBC 4, @@ -666,7 +669,7 @@ The <action> type attribute can be add,update,fix,remove. Clarified javadoc for BasicDataSource close() method. </action> <action dev="psteitz" type="add" issue="DBCP-204" due-to="Wei Chen"> - Made PoolingConnection pool CallableStatements. When BasicDataSource's + Made PoolingConnection pool CallableStatements. When BasicDataSource's poolPreparedStatements property is true, CallableStatements are now pooled along with PreparedStatements. The maxOpenPreparedStatements property limits the combined number of Callable and Prepared statements @@ -706,7 +709,7 @@ The <action> type attribute can be add,update,fix,remove. <action dev="psteitz" type="add" issue="DBCP-226"> Added a validationQueryTimeout configuration parameter to BasicDataSource allowing the user to specify a timeout value (in seconds) for connection - validation queries. + validation queries. </action> <action dev="psteitz" type="add" issue="DBCP-175" due-to="Jiri Melichna and Jerome Lacoste"> Added a connectionInitSqls configuration parameter to BasicDataSource @@ -760,8 +763,8 @@ The <action> type attribute can be add,update,fix,remove. Eliminated unused private "parent" field in AbandonedTrace. </action> <action dev="psteitz" type="fix" issue="DBCP-273" due-to="Mark Lin"> - Fixed errors handling boolean-valued Reference properties in - InstanceKeyObjectFactory, DriverAdapterCPDS that were causing + Fixed errors handling boolean-valued Reference properties in + InstanceKeyObjectFactory, DriverAdapterCPDS that were causing testOnBorrow and poolPreparedStatements properties to be incorrectly set when creating objects from javax.naming.Reference instances. </action> @@ -801,11 +804,11 @@ The <action> type attribute can be add,update,fix,remove. </action> <action dev="psteitz" type="update" issue="DBCP-11" due-to="Dain Sundstrom"> Modified PoolingDataSource, PoolingDriver and DelegatingStatement to - assure that all returned Statements, PreparedStatements, + assure that all returned Statements, PreparedStatements, CallableStatements and ResultSets are wrapped with a delegating object, which already properly handle the back pointers for Connection and - Statement. Also added tests to to assure that the *same* object used - to create the statement or result set is returned from either + Statement. Also added tests to to assure that the *same* object used + to create the statement or result set is returned from either getConnection() or getStatement(). </action> <action dev="dain" type="update" issue="DBCP-143"> @@ -819,35 +822,35 @@ The <action> type attribute can be add,update,fix,remove. active connections are closed, they are destroyed. </action> <action dev="psteitz" type="fix" issue="DBCP-241"> - Eliminated potential sources of NullPointerExceptions in + Eliminated potential sources of NullPointerExceptions in PoolingConnection. </action> <action dev="psteitz" type="fix" issue="DBCP-216" due-to="Marcos Sanz"> - Improved error recovery and listener cleanup in + Improved error recovery and listener cleanup in KeyedCPDSConnectionFactory. Substituted calls to destroyObject with _pool.invalidateObject on error to ensure pool active count is decremented on error events. Ensured that events from closed or invalid - connections are ignored and listeners are cleaned up. + connections are ignored and listeners are cleaned up. </action> <action dev="psteitz" type="fix" issue="DBCP-245" due-to="Michael Drechsel"> - Fixed error in SharedPoolDataSource causing incorrect passwords to be + Fixed error in SharedPoolDataSource causing incorrect passwords to be stored under certain conditions. - </action> + </action> <action dev="psteitz" type="fix" issue="DBCP-237" due-to="Oliver Matz"> Added exception handler to ensure that PooledConnections are not - orphaned when an exception occurs in setUpDefaults or clearWarnings in + orphaned when an exception occurs in setUpDefaults or clearWarnings in InstanceKeyDataSource.getConnection. - </action> + </action> <action dev="psteitz" type="fix" issue="DBCP-252" due-to="FindBugs"> Made getPool synchronized in PoolableConnectionFactory. Fixes inconsistent synchronization accessing _pool. - </action> + </action> <action dev="psteitz" type="fix" issue="DBCP-252" due-to="FindBugs"> Fixed inconsistent synchronization on _rollbackAfterValidation, - _validationQuery and _pool in CPDSConnectionFactory and + _validationQuery and _pool in CPDSConnectionFactory and KeyedCPDSConnectionFactory by making the first two volatile and making both getter and setter for _pool synchronized. - </action> + </action> </release> <release version="1.3" date="2010-02-14" description="Compatability release for JDBC 3. See version 1.4 description and change log."> @@ -907,7 +910,7 @@ The <action> type attribute can be add,update,fix,remove. <action dev="dennisl" type="fix" issue="DBCP-144" due-to="Sebb"> Fix broken website links for examples. </action> - <action dev="psteitz" type="fix" issue="DBCP-28" + <action dev="psteitz" type="fix" issue="DBCP-28" due-to="Huw Lewis, James Ring"> Modified PoolableConnection close method to invalidate instance when invoked on an already closed connection. @@ -915,7 +918,7 @@ The <action> type attribute can be add,update,fix,remove. <action dev="joehni" type="fix" issue="DBCP-81"> Inserted null checks to avoid NPE in close operations. </action> - <action dev="psteitz" type="fix" issue="DBCP-105" + <action dev="psteitz" type="fix" issue="DBCP-105" due-to="Sandy McArthur, Thomas Fischer"> Changed getReference method in InstanceKeyDataSource to return a concrete factory and added implementations of getReference in concrete @@ -954,7 +957,7 @@ The <action> type attribute can be add,update,fix,remove. in SharedPoolDataSource. </action> <action dev="psteitz" type="fix" issue="DBCP-198"> - Changed implementation of equals in + Changed implementation of equals in PoolingDataSource.PoolGuardConnectionWrapper to ensure it is reflexive, even when wrapped connections are not DelegatingConnections. @@ -966,41 +969,41 @@ The <action> type attribute can be add,update,fix,remove. </action> <action dev="psteitz" type="update" issue="DBCP-68"> Removed dependency on Commons Collections by adding collections - 2.1 sources for LRUMap and SequencedHashMap with package scope to + 2.1 sources for LRUMap and SequencedHashMap with package scope to datasources package. </action> <action dev="psteitz" type="fix" issue="DBCP-65"> Removed synchronization from prepareStatement methods in PoolingConnection. Synchronization in these methods was causing deadlocks. No resources other than the prepared statement pool are - accessed by these methods, and the pool methods are synchronized. + accessed by these methods, and the pool methods are synchronized. Also fixes DBCP-202. </action> - </release> + </release> <release version="1.2.1" date="2004-06-12" description="Maintenance Release to restore JDK 1.3 compatibility"> <action type="fix"> See <a href="release-notes-1.2.1.html">DBCP 1.2.1 Release Notes</a> for details. </action> - </release> + </release> <release version="1.2" date="2004-06-07"> <action type="update"> See <a href="release-notes-1.2.html">DBCP 1.2 Release Notes</a> for details. </action> - </release> + </release> <release version="1.1" date="2003-10-20"> <action type="update"> See <a href="release-notes-1.1.html">DBCP 1.1 Release Notes</a> for details. </action> - </release> - + </release> + <release version="1.0" date="2002-08-12" description="Initial Release"> <action type="add"> Initial Release </action> - </release> + </release> </body> </document> diff --git a/src/main/java/org/apache/commons/dbcp2/PoolingDataSource.java b/src/main/java/org/apache/commons/dbcp2/PoolingDataSource.java index f5f16cd..fc1965c 100644 --- a/src/main/java/org/apache/commons/dbcp2/PoolingDataSource.java +++ b/src/main/java/org/apache/commons/dbcp2/PoolingDataSource.java @@ -75,7 +75,7 @@ public class PoolingDataSource<C extends Connection> implements DataSource, Auto * @since 2.1 */ @Override - public void close() throws Exception { + public void close() throws RuntimeException, SQLException { try { pool.close(); } catch (final RuntimeException rte) {