You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/06/23 14:20:44 UTC
[commons-dbcp] 02/02: PoolingDataSource.close() now always throws SQLException
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
commit cbcac4d6e59651827b29e7fb1623071665d65ad0
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 09:41:28 2023 -0400
PoolingDataSource.close() now always throws SQLException
---
src/changes/changes.xml | 3 +++
src/main/java/org/apache/commons/dbcp2/PoolingDataSource.java | 4 +---
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 1d8253ff..6e59379f 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -121,6 +121,9 @@ The <action> type attribute can be add,update,fix,remove.
<action dev="ggregory" type="fix" due-to="Gary Gregory">
CPDSConnectionFactory.makeObject() does not need to wrap and rethrow SQLException.
</action>
+ <action dev="ggregory" type="fix" due-to="Gary Gregory">
+ PoolingDataSource.close() now always throws SQLException.
+ </action>
<!-- ADD -->
<action dev="ggregory" type="add" due-to="Gary Gregory">
Add and use AbandonedTrace#setLastUsed(Instant).
diff --git a/src/main/java/org/apache/commons/dbcp2/PoolingDataSource.java b/src/main/java/org/apache/commons/dbcp2/PoolingDataSource.java
index 40d2c1c2..8643b5ab 100644
--- a/src/main/java/org/apache/commons/dbcp2/PoolingDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/PoolingDataSource.java
@@ -121,11 +121,9 @@ public class PoolingDataSource<C extends Connection> implements DataSource, Auto
* @since 2.1
*/
@Override
- public void close() throws RuntimeException, SQLException {
+ public void close() throws SQLException {
try {
pool.close();
- } catch (final RuntimeException rte) {
- throw new RuntimeException(Utils.getMessage("pool.close.fail"), rte);
} catch (final Exception e) {
throw new SQLException(Utils.getMessage("pool.close.fail"), e);
}