You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2019/12/10 10:53:07 UTC
[tomcat] branch master updated: Fix
https://bz.apache.org/bugzilla/show_bug.cgi?id=63995 close statement
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push:
new dd34003 Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63995 close statement
dd34003 is described below
commit dd34003d1d2b30354fdfc86f0f606f5679cc2097
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Dec 10 10:52:37 2019 +0000
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63995 close statement
Also do a complete code review of the DBCP 2 fork and fix one additional
difference.
---
.../tomcat/dbcp/dbcp2/DelegatingConnection.java | 2 +-
.../apache/tomcat/dbcp/dbcp2/DelegatingStatement.java | 19 ++++++++++---------
webapps/docs/changelog.xml | 8 ++++++++
3 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/java/org/apache/tomcat/dbcp/dbcp2/DelegatingConnection.java b/java/org/apache/tomcat/dbcp/dbcp2/DelegatingConnection.java
index b06546a..1a83305 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/DelegatingConnection.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/DelegatingConnection.java
@@ -621,7 +621,7 @@ public class DelegatingConnection<C extends Connection> extends AbandonedTrace i
// Statement's when it is closed.
// DBCP-288. Not all the traced objects will be statements
final List<AbandonedTrace> traces = getTrace();
- if (traces != null && traces.isEmpty()) {
+ if (traces != null && !traces.isEmpty()) {
final List<Exception> thrownList = new ArrayList<>();
final Iterator<AbandonedTrace> traceIter = traces.iterator();
while (traceIter.hasNext()) {
diff --git a/java/org/apache/tomcat/dbcp/dbcp2/DelegatingStatement.java b/java/org/apache/tomcat/dbcp/dbcp2/DelegatingStatement.java
index daa0c04..e5dfd78 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/DelegatingStatement.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/DelegatingStatement.java
@@ -155,16 +155,17 @@ public class DelegatingStatement extends AbandonedTrace implements Statement {
}
clearTrace();
}
- if (statement != null) {
- try {
- statement.close();
- } catch (Exception e) {
- if (connection != null) {
- // Does not rethrow e.
- connection.handleExceptionNoThrow(e);
- }
- thrownList.add(e);
+ clearTrace();
+ }
+ if (statement != null) {
+ try {
+ statement.close();
+ } catch (Exception e) {
+ if (connection != null) {
+ // Does not rethrow e.
+ connection.handleExceptionNoThrow(e);
}
+ thrownList.add(e);
}
}
} finally {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 35faddf..ea5117b 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -56,6 +56,14 @@
</fix>
</changelog>
</subsection>
+ <subsection name="Other">
+ <changelog>
+ <fix>
+ <bug>63995</bug>: Ensure statements are closed when a pooled JDBC
+ connection is passivated in Tomcat's fork of Commons DBCP2. (markt)
+ </fix>
+ </changelog>
+ </subsection>
</section>
<section name="Tomcat 9.0.30 (markt)" rtext="release in progress">
<subsection name="Catalina">
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org