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/08/09 16:48:40 UTC

[tomcat] branch 8.5.x updated: Merge additional fix for DBCP-555

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
     new c3761d2  Merge additional fix for DBCP-555
c3761d2 is described below

commit c3761d202b06121dd82d7632e0344f19d77038d2
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Aug 9 17:47:36 2019 +0100

    Merge additional fix for DBCP-555
---
 MERGE.txt                                                      |  2 +-
 java/org/apache/tomcat/dbcp/dbcp2/DelegatingConnection.java    | 10 +++++-----
 java/org/apache/tomcat/dbcp/dbcp2/DelegatingStatement.java     | 10 +++++-----
 .../apache/tomcat/dbcp/dbcp2/PoolableCallableStatement.java    |  8 ++++----
 .../apache/tomcat/dbcp/dbcp2/PoolablePreparedStatement.java    |  8 ++++----
 java/org/apache/tomcat/dbcp/dbcp2/SQLExceptionList.java        |  8 +++++++-
 webapps/docs/changelog.xml                                     |  2 +-
 7 files changed, 27 insertions(+), 21 deletions(-)

diff --git a/MERGE.txt b/MERGE.txt
index 396405a..18da378 100644
--- a/MERGE.txt
+++ b/MERGE.txt
@@ -63,7 +63,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:
-87d9e3a66b896d81339a0947d001837ad2651605 (2019-08-01)
+4813b7f5456c1f4fecc4f701ac731a71f57db249 (2019-08-09)
 
 Pool2
 Sub-tree
diff --git a/java/org/apache/tomcat/dbcp/dbcp2/DelegatingConnection.java b/java/org/apache/tomcat/dbcp/dbcp2/DelegatingConnection.java
index 21d77eb..b06546a 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/DelegatingConnection.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/DelegatingConnection.java
@@ -622,7 +622,7 @@ public class DelegatingConnection<C extends Connection> extends AbandonedTrace i
         // DBCP-288. Not all the traced objects will be statements
         final List<AbandonedTrace> traces = getTrace();
         if (traces != null && traces.isEmpty()) {
-            final List<Exception> thrown = new ArrayList<>();
+            final List<Exception> thrownList = new ArrayList<>();
             final Iterator<AbandonedTrace> traceIter = traces.iterator();
             while (traceIter.hasNext()) {
                 final Object trace = traceIter.next();
@@ -630,7 +630,7 @@ public class DelegatingConnection<C extends Connection> extends AbandonedTrace i
                     try {
                         ((Statement) trace).close();
                     } catch (Exception e) {
-                        thrown.add(e);
+                        thrownList.add(e);
                     }
                 } else if (trace instanceof ResultSet) {
                     // DBCP-265: Need to close the result sets that are
@@ -638,13 +638,13 @@ public class DelegatingConnection<C extends Connection> extends AbandonedTrace i
                     try {
                         ((ResultSet) trace).close();
                     } catch (Exception e) {
-                        thrown.add(e);
+                        thrownList.add(e);
                     }
                 }
             }
             clearTrace();
-            if (!thrown.isEmpty()) {
-                throw new SQLExceptionList(thrown);
+            if (!thrownList.isEmpty()) {
+                throw new SQLExceptionList(thrownList);
             }
         }
         setLastUsed(0);
diff --git a/java/org/apache/tomcat/dbcp/dbcp2/DelegatingStatement.java b/java/org/apache/tomcat/dbcp/dbcp2/DelegatingStatement.java
index 2537eae..52f9e26 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/DelegatingStatement.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/DelegatingStatement.java
@@ -126,7 +126,7 @@ public class DelegatingStatement extends AbandonedTrace implements Statement {
         if (isClosed()) {
             return;
         }
-        final List<Exception> thrown = new ArrayList<>();
+        final List<Exception> thrownList = new ArrayList<>();
         try {
             if (connection != null) {
                 connection.removeTrace(this);
@@ -150,7 +150,7 @@ public class DelegatingStatement extends AbandonedTrace implements Statement {
                                 // Does not rethrow e.
                                 connection.handleExceptionNoThrow(e);
                             }
-                            thrown.add(e);
+                            thrownList.add(e);
                         }
                     }
                     clearTrace();
@@ -163,15 +163,15 @@ public class DelegatingStatement extends AbandonedTrace implements Statement {
                             // Does not rethrow e.
                             connection.handleExceptionNoThrow(e);
                         }
-                        thrown.add(e);
+                        thrownList.add(e);
                     }
                 }
             }
         } finally {
             closed = true;
             statement = null;
-            if (!thrown.isEmpty()) {
-                throw new SQLExceptionList(thrown);
+            if (!thrownList.isEmpty()) {
+                throw new SQLExceptionList(thrownList);
             }
         }
     }
diff --git a/java/org/apache/tomcat/dbcp/dbcp2/PoolableCallableStatement.java b/java/org/apache/tomcat/dbcp/dbcp2/PoolableCallableStatement.java
index 9c0be44..7801099 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/PoolableCallableStatement.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/PoolableCallableStatement.java
@@ -122,20 +122,20 @@ public class PoolableCallableStatement extends DelegatingCallableStatement {
         // See DBCP-10 for what could happen when ResultSets are closed twice.
         final List<AbandonedTrace> resultSetList = getTrace();
         if (resultSetList != null) {
-            final List<Exception> thrown = new ArrayList<>();
+            final List<Exception> thrownList = new ArrayList<>();
             final ResultSet[] resultSets = resultSetList.toArray(new ResultSet[resultSetList.size()]);
             for (final ResultSet resultSet : resultSets) {
                 if (resultSet != null) {
                     try {
                         resultSet.close();
                     } catch (Exception e) {
-                        thrown.add(e);
+                        thrownList.add(e);
                     }
                 }
             }
             clearTrace();
-            if (!thrown.isEmpty()) {
-                throw new SQLExceptionList(thrown);
+            if (!thrownList.isEmpty()) {
+                throw new SQLExceptionList(thrownList);
             }
         }
 
diff --git a/java/org/apache/tomcat/dbcp/dbcp2/PoolablePreparedStatement.java b/java/org/apache/tomcat/dbcp/dbcp2/PoolablePreparedStatement.java
index d8e45c4..9e96b94 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/PoolablePreparedStatement.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/PoolablePreparedStatement.java
@@ -137,20 +137,20 @@ public class PoolablePreparedStatement<K> extends DelegatingPreparedStatement {
         // See bug 17301 for what could happen when ResultSets are closed twice.
         final List<AbandonedTrace> resultSetList = getTrace();
         if (resultSetList != null) {
-            final List<Exception> thrown = new ArrayList<>();
+            final List<Exception> thrownList = new ArrayList<>();
             final ResultSet[] resultSets = resultSetList.toArray(new ResultSet[resultSetList.size()]);
             for (final ResultSet resultSet : resultSets) {
                 if (resultSet != null) {
                     try {
                         resultSet.close();
                     } catch (Exception e) {
-                        thrown.add(e);
+                        thrownList.add(e);
                     }
                 }
             }
             clearTrace();
-            if (!thrown.isEmpty()) {
-                throw new SQLExceptionList(thrown);
+            if (!thrownList.isEmpty()) {
+                throw new SQLExceptionList(thrownList);
             }
         }
 
diff --git a/java/org/apache/tomcat/dbcp/dbcp2/SQLExceptionList.java b/java/org/apache/tomcat/dbcp/dbcp2/SQLExceptionList.java
index b740ba0..6f24f04 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/SQLExceptionList.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/SQLExceptionList.java
@@ -40,10 +40,16 @@ public class SQLExceptionList extends SQLException {
      * @param causeList a list of cause exceptions.
      */
     public SQLExceptionList(List<? extends Throwable> causeList) {
-        super(String.format("%,d exceptions: %s", Integer.valueOf(causeList.size()), causeList), causeList.get(0));
+        super(String.format("%,d exceptions: %s", Integer.valueOf(causeList == null ? 0 : causeList.size()), causeList),
+                causeList == null ? null : causeList.get(0));
         this.causeList = causeList;
     }
 
+    /**
+     * Gets the cause list.
+     *
+     * @return The list of causes.
+     */
     public List<? extends Throwable> getCauseList() {
         return causeList;
     }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 22c0edf..b70e9fe 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -207,7 +207,7 @@
       </update>
       <update>
         Update the internal fork of Commons DBCP2 to 87d9e3a (2018-08-01) to
-        pick up the changes Commons DBCP2 2.7.0 RC1. (markt)
+        pick up the changes Commons DBCP2 2.7.0 and DBCP-555. (markt)
       </update>
       <update>
         <bug>63648</bug>: Update the test TLS keys and certificates used in the


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org