From 4a7ebbbc7cdec4051f2fc242e3a7d20070defeb9 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 14 Jun 2024 06:08:18 -0400
Subject: [PATCH 001/169] Bump github/codeql-action from 3.25.8 to 3.25.10
(#396)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.25.8 to 3.25.10.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/2e230e8fe0ad3a14a340ad0815ddb96d599d2aff...23acc5c183826b7a8a97bce3cecc52db901f8251)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/codeql-analysis.yml | 6 +++---
.github/workflows/scorecards-analysis.yml | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 7e014f8759..12acd6d4fa 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -57,7 +57,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
- uses: github/codeql-action/init@2e230e8fe0ad3a14a340ad0815ddb96d599d2aff # 3.25.8
+ uses: github/codeql-action/init@23acc5c183826b7a8a97bce3cecc52db901f8251 # 3.25.10
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -68,7 +68,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
- uses: github/codeql-action/autobuild@2e230e8fe0ad3a14a340ad0815ddb96d599d2aff # 3.25.8
+ uses: github/codeql-action/autobuild@23acc5c183826b7a8a97bce3cecc52db901f8251 # 3.25.10
# âšī¸ Command-line programs to run using the OS shell.
# đ https://git.io/JvXDl
@@ -82,4 +82,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@2e230e8fe0ad3a14a340ad0815ddb96d599d2aff # 3.25.8
+ uses: github/codeql-action/analyze@23acc5c183826b7a8a97bce3cecc52db901f8251 # 3.25.10
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index ae7a6eacd8..61d000ddd4 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -64,6 +64,6 @@ jobs:
retention-days: 5
- name: "Upload to code-scanning"
- uses: github/codeql-action/upload-sarif@2e230e8fe0ad3a14a340ad0815ddb96d599d2aff # 3.25.8
+ uses: github/codeql-action/upload-sarif@23acc5c183826b7a8a97bce3cecc52db901f8251 # 3.25.10
with:
sarif_file: results.sarif
From 569ae858494348553fd03b4e7347d864321f166e Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 14 Jun 2024 06:08:32 -0400
Subject: [PATCH 002/169] Bump codecov/codecov-action from 4.4.1 to 4.5.0
(#398)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4.4.1 to 4.5.0.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/125fc84a9a348dbcf27191600683ec096ec9021c...e28ff129e5465c2c0dcc6f003fc735cb6ae0c673)
---
updated-dependencies:
- dependency-name: codecov/codecov-action
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/coverage.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index 5cd1566cb1..c6a3d9a277 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -47,6 +47,6 @@ jobs:
run: mvn --show-version --batch-mode --no-transfer-progress test jacoco:report
- name: Upload coverage to Codecov
- uses: codecov/codecov-action@125fc84a9a348dbcf27191600683ec096ec9021c # v4.4.1
+ uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
files: ./target/site/jacoco/jacoco.xml
From affb6b5010dfff48aaa47f085716e75093727855 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 14 Jun 2024 06:08:45 -0400
Subject: [PATCH 003/169] Bump actions/checkout from 4.1.6 to 4.1.7 (#397)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.6 to 4.1.7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/a5ac7e51b41094c92402da3b24376905380afc29...692973e3d937129bcbf40652eb9f2f61becf3332)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/codeql-analysis.yml | 2 +-
.github/workflows/coverage.yml | 2 +-
.github/workflows/maven.yml | 2 +-
.github/workflows/scorecards-analysis.yml | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 12acd6d4fa..e70708d23b 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -45,7 +45,7 @@ jobs:
steps:
- name: Checkout repository
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index c6a3d9a277..8367dfe1b2 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -29,7 +29,7 @@ jobs:
java: [ 8 ]
steps:
- - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
+ - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index c6de493ed0..65a377ca23 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -34,7 +34,7 @@ jobs:
# experimental: true
steps:
- - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
+ - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index 61d000ddd4..7efca3176b 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -40,7 +40,7 @@ jobs:
steps:
- name: "Checkout code"
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false
From dd32100b5796f18abea994dfeb2c8acf69eb962e Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Tue, 18 Jun 2024 09:16:17 -0400
Subject: [PATCH 004/169] Javadoc
---
.../apache/commons/dbcp2/datasources/PerUserPoolDataSource.java | 2 +-
.../apache/commons/dbcp2/datasources/SharedPoolDataSource.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSource.java b/src/main/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSource.java
index 85d7491ad0..1b60c498df 100644
--- a/src/main/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSource.java
@@ -687,7 +687,7 @@ Map put(Map map, final K key, final V value) {
* Supports Serialization interface.
*
* @param in
- * a {@link java.io.ObjectInputStream} value
+ * a {@link ObjectInputStream} value
* @throws IOException
* if an error occurs
* @throws ClassNotFoundException
diff --git a/src/main/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java b/src/main/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java
index d14ff58362..31e7aeda08 100644
--- a/src/main/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java
@@ -145,7 +145,7 @@ public Reference getReference() throws NamingException {
* Supports Serialization interface.
*
* @param in
- * a {@link java.io.ObjectInputStream} value
+ * a {@link ObjectInputStream} value
* @throws IOException
* if an error occurs
* @throws ClassNotFoundException
From 13bb605afd3b31750f0ed8dd1a1aa1a0e1776e6f Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sun, 23 Jun 2024 15:50:59 -0400
Subject: [PATCH 005/169] Javadoc
---
.../dbcp2/datasources/PerUserPoolDataSource.java | 11 ++++-------
.../dbcp2/datasources/SharedPoolDataSource.java | 11 ++++-------
2 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSource.java b/src/main/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSource.java
index 1b60c498df..46dcf3ae94 100644
--- a/src/main/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSource.java
@@ -684,14 +684,11 @@ Map put(Map map, final K key, final V value) {
}
/**
- * Supports Serialization interface.
+ * Deserializes an instance from an ObjectInputStream.
*
- * @param in
- * a {@link ObjectInputStream} value
- * @throws IOException
- * if an error occurs
- * @throws ClassNotFoundException
- * if an error occurs
+ * @param in The source ObjectInputStream.
+ * @throws IOException Any of the usual Input/Output related exceptions.
+ * @throws ClassNotFoundException A class of a serialized object cannot be found.
*/
@SuppressWarnings("resource")
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
diff --git a/src/main/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java b/src/main/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java
index 31e7aeda08..fd596d51da 100644
--- a/src/main/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java
@@ -142,14 +142,11 @@ public Reference getReference() throws NamingException {
}
/**
- * Supports Serialization interface.
+ * Deserializes an instance from an ObjectInputStream.
*
- * @param in
- * a {@link ObjectInputStream} value
- * @throws IOException
- * if an error occurs
- * @throws ClassNotFoundException
- * if an error occurs
+ * @param in The source ObjectInputStream.
+ * @throws IOException Any of the usual Input/Output related exceptions.
+ * @throws ClassNotFoundException A class of a serialized object cannot be found.
*/
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
From 6352dcab43cdba05f7c68ae2f3c9217e68609079 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 29 Jun 2024 08:02:20 -0400
Subject: [PATCH 006/169] Drop CodeQL
- It now requires an API key and a login to view reports
- Instead, use 'mvn clean install site -P jacoco' to view JaCoCo HTML
reports
---
README.md | 1 -
1 file changed, 1 deletion(-)
diff --git a/README.md b/README.md
index 954b884ae6..7367fb7b22 100644
--- a/README.md
+++ b/README.md
@@ -47,7 +47,6 @@ Apache Commons DBCP
[![Coverage Status](https://codecov.io/gh/apache/commons-dbcp/branch/master/graph/badge.svg)](https://app.codecov.io/gh/apache/commons-dbcp)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.apache.commons/commons-dbcp2/badge.svg?gav=true)](https://maven-badges.herokuapp.com/maven-central/org.apache.commons/commons-dbcp2/?gav=true)
[![Javadocs](https://javadoc.io/badge/org.apache.commons/commons-dbcp2/2.12.0.svg)](https://javadoc.io/doc/org.apache.commons/commons-dbcp2/2.12.0)
-[![CodeQL](https://github.com/apache/commons-dbcp/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/apache/commons-dbcp/actions/workflows/codeql-analysis.yml)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/apache/commons-dbcp/badge)](https://api.securityscorecards.dev/projects/github.com/apache/commons-dbcp)
Apache Commons DBCP software implements Database Connection Pooling
From 6a2137142c8f73cb57eeb69c8417d348be7c2236 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 29 Jun 2024 08:11:00 -0400
Subject: [PATCH 007/169] Drop CodeQL
- It now requires an API key and a login to view reports
- Instead, use 'mvn clean install site -P jacoco' to view JaCoCo HTML
reports
---
.github/workflows/codeql-analysis.yml | 85 ---------------------------
1 file changed, 85 deletions(-)
delete mode 100644 .github/workflows/codeql-analysis.yml
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
deleted file mode 100644
index e70708d23b..0000000000
--- a/.github/workflows/codeql-analysis.yml
+++ /dev/null
@@ -1,85 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-name: "CodeQL"
-
-on:
- push:
- branches: [ master ]
- pull_request:
- # The branches below must be a subset of the branches above
- branches: [ master ]
- schedule:
- - cron: '33 9 * * 4'
-
-permissions:
- contents: read
-
-jobs:
- analyze:
- name: Analyze
- runs-on: ubuntu-latest
- permissions:
- actions: read
- contents: read
- security-events: write
-
- strategy:
- fail-fast: false
- matrix:
- language: [ 'java' ]
- # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
- # Learn more about CodeQL language support at https://git.io/codeql-language-support
-
- steps:
- - name: Checkout repository
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- with:
- persist-credentials: false
- - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
- with:
- path: ~/.m2/repository
- key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- restore-keys: |
- ${{ runner.os }}-maven-
-
- # Initializes the CodeQL tools for scanning.
- - name: Initialize CodeQL
- uses: github/codeql-action/init@23acc5c183826b7a8a97bce3cecc52db901f8251 # 3.25.10
- with:
- languages: ${{ matrix.language }}
- # If you wish to specify custom queries, you can do so here or in a config file.
- # By default, queries listed here will override any specified in a config file.
- # Prefix the list here with "+" to use these queries and those in the config file.
- # queries: ./path/to/local/query, your-org/your-repo/queries@main
-
- # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
- # If this step fails, then you should remove it and run the build manually (see below)
- - name: Autobuild
- uses: github/codeql-action/autobuild@23acc5c183826b7a8a97bce3cecc52db901f8251 # 3.25.10
-
- # âšī¸ Command-line programs to run using the OS shell.
- # đ https://git.io/JvXDl
-
- # âī¸ If the Autobuild fails above, remove it and uncomment the following three lines
- # and modify them (or add more) to build your code if your project
- # uses a compiled language
-
- #- run: |
- # make bootstrap
- # make release
-
- - name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@23acc5c183826b7a8a97bce3cecc52db901f8251 # 3.25.10
From cf78f942d39b0c1b1f4556b5dd54dc7efb5c99af Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 29 Jun 2024 10:49:21 -0400
Subject: [PATCH 008/169] Revert "Drop CodeQL"
This reverts commit 6a2137142c8f73cb57eeb69c8417d348be7c2236.
---
.github/workflows/codeql-analysis.yml | 85 +++++++++++++++++++++++++++
1 file changed, 85 insertions(+)
create mode 100644 .github/workflows/codeql-analysis.yml
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
new file mode 100644
index 0000000000..e70708d23b
--- /dev/null
+++ b/.github/workflows/codeql-analysis.yml
@@ -0,0 +1,85 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+name: "CodeQL"
+
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ # The branches below must be a subset of the branches above
+ branches: [ master ]
+ schedule:
+ - cron: '33 9 * * 4'
+
+permissions:
+ contents: read
+
+jobs:
+ analyze:
+ name: Analyze
+ runs-on: ubuntu-latest
+ permissions:
+ actions: read
+ contents: read
+ security-events: write
+
+ strategy:
+ fail-fast: false
+ matrix:
+ language: [ 'java' ]
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
+ # Learn more about CodeQL language support at https://git.io/codeql-language-support
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
+ with:
+ persist-credentials: false
+ - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
+ with:
+ path: ~/.m2/repository
+ key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+ restore-keys: |
+ ${{ runner.os }}-maven-
+
+ # Initializes the CodeQL tools for scanning.
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@23acc5c183826b7a8a97bce3cecc52db901f8251 # 3.25.10
+ with:
+ languages: ${{ matrix.language }}
+ # If you wish to specify custom queries, you can do so here or in a config file.
+ # By default, queries listed here will override any specified in a config file.
+ # Prefix the list here with "+" to use these queries and those in the config file.
+ # queries: ./path/to/local/query, your-org/your-repo/queries@main
+
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
+ # If this step fails, then you should remove it and run the build manually (see below)
+ - name: Autobuild
+ uses: github/codeql-action/autobuild@23acc5c183826b7a8a97bce3cecc52db901f8251 # 3.25.10
+
+ # âšī¸ Command-line programs to run using the OS shell.
+ # đ https://git.io/JvXDl
+
+ # âī¸ If the Autobuild fails above, remove it and uncomment the following three lines
+ # and modify them (or add more) to build your code if your project
+ # uses a compiled language
+
+ #- run: |
+ # make bootstrap
+ # make release
+
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze@23acc5c183826b7a8a97bce3cecc52db901f8251 # 3.25.10
From 0d104b8f4508800354eb39f0381615d48653eef9 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 29 Jun 2024 10:49:21 -0400
Subject: [PATCH 009/169] Revert "Drop CodeQL"
This reverts commit 6352dcab43cdba05f7c68ae2f3c9217e68609079.
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index 7367fb7b22..954b884ae6 100644
--- a/README.md
+++ b/README.md
@@ -47,6 +47,7 @@ Apache Commons DBCP
[![Coverage Status](https://codecov.io/gh/apache/commons-dbcp/branch/master/graph/badge.svg)](https://app.codecov.io/gh/apache/commons-dbcp)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.apache.commons/commons-dbcp2/badge.svg?gav=true)](https://maven-badges.herokuapp.com/maven-central/org.apache.commons/commons-dbcp2/?gav=true)
[![Javadocs](https://javadoc.io/badge/org.apache.commons/commons-dbcp2/2.12.0.svg)](https://javadoc.io/doc/org.apache.commons/commons-dbcp2/2.12.0)
+[![CodeQL](https://github.com/apache/commons-dbcp/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/apache/commons-dbcp/actions/workflows/codeql-analysis.yml)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/apache/commons-dbcp/badge)](https://api.securityscorecards.dev/projects/github.com/apache/commons-dbcp)
Apache Commons DBCP software implements Database Connection Pooling
From 3d287e36bf45b32cf09bb39037ba87117669c265 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 29 Jun 2024 14:24:23 -0400
Subject: [PATCH 010/169] Drop codecov.io
- It now requires an API key and a login to view reports
- Instead, use 'mvn clean install site -P jacoco' to view JaCoCo HTML
reports
---
.github/workflows/coverage.yml | 52 ----------------------------------
README.md | 1 -
2 files changed, 53 deletions(-)
delete mode 100644 .github/workflows/coverage.yml
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
deleted file mode 100644
index 8367dfe1b2..0000000000
--- a/.github/workflows/coverage.yml
+++ /dev/null
@@ -1,52 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-name: Coverage
-
-on: [push, pull_request]
-
-permissions:
- contents: read
-
-jobs:
- build:
-
- runs-on: ubuntu-latest
- strategy:
- matrix:
- java: [ 8 ]
-
- steps:
- - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- with:
- persist-credentials: false
- - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
- with:
- path: ~/.m2/repository
- key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- restore-keys: |
- ${{ runner.os }}-maven-
- - name: Set up JDK ${{ matrix.java }}
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
- with:
- distribution: 'temurin'
- java-version: ${{ matrix.java }}
- - name: Build with Maven
- run: mvn --show-version --batch-mode --no-transfer-progress test jacoco:report
-
- - name: Upload coverage to Codecov
- uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
- with:
- files: ./target/site/jacoco/jacoco.xml
diff --git a/README.md b/README.md
index 954b884ae6..f467f4ec4c 100644
--- a/README.md
+++ b/README.md
@@ -44,7 +44,6 @@ Apache Commons DBCP
===================
[![Java CI](https://github.com/apache/commons-dbcp/actions/workflows/maven.yml/badge.svg)](https://github.com/apache/commons-dbcp/actions/workflows/maven.yml)
-[![Coverage Status](https://codecov.io/gh/apache/commons-dbcp/branch/master/graph/badge.svg)](https://app.codecov.io/gh/apache/commons-dbcp)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.apache.commons/commons-dbcp2/badge.svg?gav=true)](https://maven-badges.herokuapp.com/maven-central/org.apache.commons/commons-dbcp2/?gav=true)
[![Javadocs](https://javadoc.io/badge/org.apache.commons/commons-dbcp2/2.12.0.svg)](https://javadoc.io/doc/org.apache.commons/commons-dbcp2/2.12.0)
[![CodeQL](https://github.com/apache/commons-dbcp/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/apache/commons-dbcp/actions/workflows/codeql-analysis.yml)
From fd739ef1fb89c21ea3a8d6f796c43297ef9649cf Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 5 Jul 2024 06:46:50 -0400
Subject: [PATCH 011/169] Bump github/codeql-action from 3.25.10 to 3.25.11
(#401)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.25.10 to 3.25.11.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/23acc5c183826b7a8a97bce3cecc52db901f8251...b611370bb5703a7efb587f9d136a52ea24c5c38c)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/codeql-analysis.yml | 6 +++---
.github/workflows/scorecards-analysis.yml | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index e70708d23b..492ed75027 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -57,7 +57,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
- uses: github/codeql-action/init@23acc5c183826b7a8a97bce3cecc52db901f8251 # 3.25.10
+ uses: github/codeql-action/init@b611370bb5703a7efb587f9d136a52ea24c5c38c # 3.25.11
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -68,7 +68,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
- uses: github/codeql-action/autobuild@23acc5c183826b7a8a97bce3cecc52db901f8251 # 3.25.10
+ uses: github/codeql-action/autobuild@b611370bb5703a7efb587f9d136a52ea24c5c38c # 3.25.11
# âšī¸ Command-line programs to run using the OS shell.
# đ https://git.io/JvXDl
@@ -82,4 +82,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@23acc5c183826b7a8a97bce3cecc52db901f8251 # 3.25.10
+ uses: github/codeql-action/analyze@b611370bb5703a7efb587f9d136a52ea24c5c38c # 3.25.11
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index 7efca3176b..b8c14b15b3 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -64,6 +64,6 @@ jobs:
retention-days: 5
- name: "Upload to code-scanning"
- uses: github/codeql-action/upload-sarif@23acc5c183826b7a8a97bce3cecc52db901f8251 # 3.25.10
+ uses: github/codeql-action/upload-sarif@b611370bb5703a7efb587f9d136a52ea24c5c38c # 3.25.11
with:
sarif_file: results.sarif
From 2aba7d1c5f4bcffeac75d7c9e71b7b01a55e664e Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 5 Jul 2024 07:52:42 -0400
Subject: [PATCH 012/169] Bump commons-logging:commons-logging from 1.3.2 to
1.3.3 (#399)
Bumps commons-logging:commons-logging from 1.3.2 to 1.3.3.
---
updated-dependencies:
- dependency-name: commons-logging:commons-logging
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index f5b8ae155e..4ad507fe57 100644
--- a/pom.xml
+++ b/pom.xml
@@ -63,7 +63,7 @@
commons-loggingcommons-logging
- 1.3.2
+ 1.3.3
From 6ada0c61d30cf88ebac5035b095a120f31692e99 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 5 Jul 2024 07:53:23 -0400
Subject: [PATCH 013/169] Bump commons-logging:commons-logging from 1.3.2 to
1.3.3 #399
---
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index bbbafc3ade..8f3bef3451 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -74,7 +74,7 @@ The type attribute can be add,update,fix,remove.
Bump org.apache.commons:commons-parent from 66 to 71 #360, #371, #395.
- Bump commons-logging:commons-logging from 1.3.0 to 1.3.2 #368.
+ Bump commons-logging:commons-logging from 1.3.0 to 1.3.3 #368, #399.
From 69683ea5355c750eceeea7d610103cee862fb404 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Tue, 9 Jul 2024 10:15:48 -0400
Subject: [PATCH 014/169] Remove redundant keywords
---
src/main/java/org/apache/commons/dbcp2/DelegatingStatement.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/DelegatingStatement.java b/src/main/java/org/apache/commons/dbcp2/DelegatingStatement.java
index 3114f42b07..6c30b5555e 100644
--- a/src/main/java/org/apache/commons/dbcp2/DelegatingStatement.java
+++ b/src/main/java/org/apache/commons/dbcp2/DelegatingStatement.java
@@ -95,7 +95,7 @@ public void cancel() throws SQLException {
protected void checkOpen() throws SQLException {
if (isClosed()) {
- throw new SQLException(this.getClass().getName() + " with address: \"" + this.toString() + "\" is closed.");
+ throw new SQLException(this.getClass().getName() + " with address: \"" + toString() + "\" is closed.");
}
}
From 52c66aade7aef5fa257d0fe139af215976d3607f Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Tue, 9 Jul 2024 10:16:03 -0400
Subject: [PATCH 015/169] Use final
---
.../apache/commons/dbcp2/datasources/SharedPoolDataSource.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java b/src/main/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java
index fd596d51da..54e8b8a036 100644
--- a/src/main/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java
@@ -156,7 +156,7 @@ private void readObject(final ObjectInputStream in) throws IOException, ClassNot
private KeyedObjectPool readObjectImpl() throws IOException, ClassNotFoundException {
try {
return ((SharedPoolDataSource) new SharedPoolDataSourceFactory().getObjectInstance(getReference(), null, null, null)).pool;
- } catch (NamingException e) {
+ } catch (final NamingException e) {
throw new IOException("NamingException: " + e);
}
}
From 3367ceddc79690721fcf645a5f8cdb9a4bd23ec5 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 12 Jul 2024 07:16:57 -0400
Subject: [PATCH 016/169] Bump actions/upload-artifact from 4.3.3 to 4.3.4
(#402)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.3.3 to 4.3.4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/65462800fd760344b1a7b4382951275a0abb4808...0b2256b8c012f0828dc542b3febcab082c67f72b)
---
updated-dependencies:
- dependency-name: actions/upload-artifact
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/scorecards-analysis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index b8c14b15b3..9c3dcf97c1 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -57,7 +57,7 @@ jobs:
publish_results: true
- name: "Upload artifact"
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # 4.3.3
+ uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # 4.3.4
with:
name: SARIF file
path: results.sarif
From d3bd07b57b590a5143d8e1968556177f780f9ac6 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sun, 14 Jul 2024 12:49:31 -0400
Subject: [PATCH 017/169] Normalize instance variable names in tests
---
.../commons/dbcp2/TestConnectionPool.java | 32 ++--
.../dbcp2/TestParallelCreationWithNoIdle.java | 4 +-
.../commons/dbcp2/TesterConnection.java | 52 +++----
.../dbcp2/TesterPreparedStatement.java | 76 +++++-----
.../apache/commons/dbcp2/TesterResultSet.java | 2 +-
.../apache/commons/dbcp2/TesterStatement.java | 140 +++++++++---------
6 files changed, 153 insertions(+), 153 deletions(-)
diff --git a/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java b/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java
index 597d2cab59..acee1c87b8 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java
@@ -164,37 +164,37 @@ public void stop() {
}
final class TestThread implements Runnable {
- final java.util.Random _random = new java.util.Random();
- boolean _complete;
- boolean _failed;
- int _iter = 100;
- int _delay = 50;
+ final java.util.Random random = new java.util.Random();
+ boolean complete;
+ boolean failed;
+ int iter = 100;
+ int delay = 50;
public TestThread() {
}
public TestThread(final int iter) {
- _iter = iter;
+ this.iter = iter;
}
public TestThread(final int iter, final int delay) {
- _iter = iter;
- _delay = delay;
+ this.iter = iter;
+ this.delay = delay;
}
public boolean complete() {
- return _complete;
+ return complete;
}
public boolean failed() {
- return _failed;
+ return failed;
}
@Override
public void run() {
- for (int i = 0; i < _iter; i++) {
+ for (int i = 0; i < iter; i++) {
try {
- Thread.sleep(_random.nextInt(_delay));
+ Thread.sleep(random.nextInt(delay));
} catch (final Exception e) {
// ignored
}
@@ -202,18 +202,18 @@ public void run() {
PreparedStatement stmt = conn.prepareStatement("select 'literal', SYSDATE from dual");
ResultSet rset = stmt.executeQuery()) {
try {
- Thread.sleep(_random.nextInt(_delay));
+ Thread.sleep(random.nextInt(delay));
} catch (final Exception ignore) {
// ignored
}
} catch (final Exception e) {
e.printStackTrace();
- _failed = true;
- _complete = true;
+ failed = true;
+ complete = true;
break;
}
}
- _complete = true;
+ complete = true;
}
}
diff --git a/src/test/java/org/apache/commons/dbcp2/TestParallelCreationWithNoIdle.java b/src/test/java/org/apache/commons/dbcp2/TestParallelCreationWithNoIdle.java
index 395d4a1331..3b2ea0e1a6 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestParallelCreationWithNoIdle.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestParallelCreationWithNoIdle.java
@@ -36,7 +36,7 @@
public class TestParallelCreationWithNoIdle {
final class TestThread extends Thread {
- final java.util.Random _random = new java.util.Random();
+ final java.util.Random random = new java.util.Random();
final int iter;
final int delay;
final int delayAfter;
@@ -72,7 +72,7 @@ private void sleepMax(final int timeMax) {
return;
}
try {
- Thread.sleep(_random.nextInt(timeMax));
+ Thread.sleep(random.nextInt(timeMax));
} catch (final Exception e) {
// ignored
}
diff --git a/src/test/java/org/apache/commons/dbcp2/TesterConnection.java b/src/test/java/org/apache/commons/dbcp2/TesterConnection.java
index 00b6075199..3e6e4bb4e6 100644
--- a/src/test/java/org/apache/commons/dbcp2/TesterConnection.java
+++ b/src/test/java/org/apache/commons/dbcp2/TesterConnection.java
@@ -40,15 +40,15 @@
*/
public class TesterConnection extends AbandonedTrace implements Connection {
- protected boolean _open = true;
- protected boolean _aborted;
- protected boolean _autoCommit = true;
- protected int _transactionIsolation = 1;
- protected final DatabaseMetaData _metaData = new TesterDatabaseMetaData();
- protected String _catalog;
+ protected boolean open = true;
+ protected boolean aborted;
+ protected boolean autoCommit = true;
+ protected int transactionIsolation = 1;
+ protected final DatabaseMetaData metaData = new TesterDatabaseMetaData();
+ protected String catalog;
protected String schema;
- protected Map> _typeMap;
- protected boolean _readOnly;
+ protected Map> typeMap;
+ protected boolean readOnly;
protected SQLWarning warnings;
protected final String userName;
protected Exception failure;
@@ -62,8 +62,8 @@ public class TesterConnection extends AbandonedTrace implements Connection {
@Override
public void abort(final Executor executor) throws SQLException {
checkFailure();
- _aborted = true;
- _open = false;
+ aborted = true;
+ open = false;
}
protected void checkFailure() throws SQLException {
@@ -76,7 +76,7 @@ protected void checkFailure() throws SQLException {
}
protected void checkOpen() throws SQLException {
- if (!_open) {
+ if (!open) {
throw new SQLException("Connection is closed.");
}
checkFailure();
@@ -91,7 +91,7 @@ public void clearWarnings() throws SQLException {
@Override
public void close() throws SQLException {
checkFailure();
- _open = false;
+ open = false;
}
@Override
@@ -155,13 +155,13 @@ public Struct createStruct(final String typeName, final Object[] attributes) thr
@Override
public boolean getAutoCommit() throws SQLException {
checkOpen();
- return _autoCommit;
+ return autoCommit;
}
@Override
public String getCatalog() throws SQLException {
checkOpen();
- return _catalog;
+ return catalog;
}
@Override
@@ -182,7 +182,7 @@ public int getHoldability() throws SQLException {
@Override
public DatabaseMetaData getMetaData() throws SQLException {
checkOpen();
- return _metaData;
+ return metaData;
}
@Override
@@ -199,13 +199,13 @@ public String getSchema() throws SQLException {
@Override
public int getTransactionIsolation() throws SQLException {
checkOpen();
- return _transactionIsolation;
+ return transactionIsolation;
}
@Override
public Map> getTypeMap() throws SQLException {
checkOpen();
- return _typeMap;
+ return typeMap;
}
public String getUserName() {
@@ -220,19 +220,19 @@ public SQLWarning getWarnings() throws SQLException {
public boolean isAborted() throws SQLException {
checkFailure();
- return _aborted;
+ return aborted;
}
@Override
public boolean isClosed() throws SQLException {
checkFailure();
- return !_open;
+ return !open;
}
@Override
public boolean isReadOnly() throws SQLException {
checkOpen();
- return _readOnly;
+ return readOnly;
}
public boolean isSqlExceptionOnClose() {
@@ -241,7 +241,7 @@ public boolean isSqlExceptionOnClose() {
@Override
public boolean isValid(final int timeout) throws SQLException {
- return _open;
+ return open;
}
@Override
@@ -352,13 +352,13 @@ public void rollback(final java.sql.Savepoint savepoint) throws SQLException {
@Override
public void setAutoCommit(final boolean autoCommit) throws SQLException {
checkOpen();
- _autoCommit = autoCommit;
+ this.autoCommit = autoCommit;
}
@Override
public void setCatalog(final String catalog) throws SQLException {
checkOpen();
- _catalog = catalog;
+ this.catalog = catalog;
}
@Override
@@ -389,7 +389,7 @@ public void setNetworkTimeout(final Executor executor, final int milliseconds)
@Override
public void setReadOnly(final boolean readOnly) throws SQLException {
checkOpen();
- _readOnly = readOnly;
+ this.readOnly = readOnly;
}
@Override
@@ -415,13 +415,13 @@ public void setSqlExceptionOnClose(final boolean sqlExceptionOnClose) {
@Override
public void setTransactionIsolation(final int level) throws SQLException {
checkOpen();
- _transactionIsolation = level;
+ this.transactionIsolation = level;
}
@Override
public void setTypeMap(final Map> map) throws SQLException {
checkOpen();
- _typeMap = map;
+ this.typeMap = map;
}
public void setWarnings(final SQLWarning warning) {
diff --git a/src/test/java/org/apache/commons/dbcp2/TesterPreparedStatement.java b/src/test/java/org/apache/commons/dbcp2/TesterPreparedStatement.java
index 3d11bbb7fa..b171c8577c 100644
--- a/src/test/java/org/apache/commons/dbcp2/TesterPreparedStatement.java
+++ b/src/test/java/org/apache/commons/dbcp2/TesterPreparedStatement.java
@@ -40,17 +40,17 @@
*/
public class TesterPreparedStatement extends TesterStatement implements PreparedStatement {
- private final ResultSetMetaData _resultSetMetaData = null;
- private String _sql;
- private String _catalog;
- private int _autoGeneratedKeys = 1;
- private int[] _columnIndexes;
- private String[] _columnNames;
+ private final ResultSetMetaData resultSetMetaData = null;
+ private String sql;
+ private String catalog;
+ private int autoGeneratedKeys = 1;
+ private int[] columnIndexes;
+ private String[] columnNames;
public TesterPreparedStatement(final Connection conn) {
super(conn);
try {
- _catalog = conn.getCatalog();
+ this.catalog = conn.getCatalog();
} catch (final SQLException e) {
// Ignored
}
@@ -58,9 +58,9 @@ public TesterPreparedStatement(final Connection conn) {
public TesterPreparedStatement(final Connection conn, final String sql) {
super(conn);
- _sql = sql;
+ this.sql = sql;
try {
- _catalog = conn.getCatalog();
+ this.catalog = conn.getCatalog();
} catch (final SQLException e) {
// Ignored
}
@@ -68,10 +68,10 @@ public TesterPreparedStatement(final Connection conn, final String sql) {
public TesterPreparedStatement(final Connection conn, final String sql, final int autoGeneratedKeys) {
super(conn);
- _sql = sql;
- _autoGeneratedKeys = autoGeneratedKeys;
+ this.sql = sql;
+ this.autoGeneratedKeys = autoGeneratedKeys;
try {
- _catalog = conn.getCatalog();
+ this.catalog = conn.getCatalog();
} catch (final SQLException e) {
// Ignored
}
@@ -79,9 +79,9 @@ public TesterPreparedStatement(final Connection conn, final String sql, final in
public TesterPreparedStatement(final Connection conn, final String sql, final int resultSetType, final int resultSetConcurrency) {
super(conn, resultSetType, resultSetConcurrency);
- _sql = sql;
+ this.sql = sql;
try {
- _catalog = conn.getCatalog();
+ this.catalog = conn.getCatalog();
} catch (final SQLException e) {
// Ignored
}
@@ -90,9 +90,9 @@ public TesterPreparedStatement(final Connection conn, final String sql, final in
public TesterPreparedStatement(final Connection conn, final String sql, final int resultSetType, final int resultSetConcurrency,
final int resultSetHoldability) {
super(conn, resultSetType, resultSetConcurrency, resultSetHoldability);
- _sql = sql;
+ this.sql = sql;
try {
- _catalog = conn.getCatalog();
+ this.catalog = conn.getCatalog();
} catch (final SQLException e) {
// Ignored
}
@@ -100,10 +100,10 @@ public TesterPreparedStatement(final Connection conn, final String sql, final in
public TesterPreparedStatement(final Connection conn, final String sql, final int[] columnIndexes) {
super(conn);
- _sql = sql;
- _columnIndexes = columnIndexes;
+ this.sql = sql;
+ this.columnIndexes = columnIndexes;
try {
- _catalog = conn.getCatalog();
+ this.catalog = conn.getCatalog();
} catch (final SQLException e) {
// Ignored
}
@@ -111,10 +111,10 @@ public TesterPreparedStatement(final Connection conn, final String sql, final in
public TesterPreparedStatement(final Connection conn, final String sql, final String[] columnNames) {
super(conn);
- _sql = sql;
- _columnNames = columnNames;
+ this.sql = sql;
+ this.columnNames = columnNames;
try {
- _catalog = conn.getCatalog();
+ this.catalog = conn.getCatalog();
} catch (final SQLException e) {
// Ignored
}
@@ -156,13 +156,13 @@ public boolean execute(final String sql, final String[] columnNames) throws SQLE
@Override
public long executeLargeUpdate() throws SQLException {
checkOpen();
- return _rowsUpdated;
+ return rowsUpdated;
}
@Override
public long executeLargeUpdate(final String sql) throws SQLException {
checkOpen();
- return _rowsUpdated;
+ return rowsUpdated;
}
@Override
@@ -186,14 +186,14 @@ public long executeLargeUpdate(final String sql, final String[] columnNames) thr
@Override
public ResultSet executeQuery() throws SQLException {
checkOpen();
- if ("null".equals(_sql)) {
+ if ("null".equals(sql)) {
return null;
}
- if (_queryTimeout > 0 && _queryTimeout < 5) {
+ if (queryTimeout > 0 && queryTimeout < 5) {
// Simulate timeout if queryTimout is set to less than 5 seconds
throw new SQLException("query timeout");
}
- return new TesterResultSet(this, _resultSetType, _resultSetConcurrency);
+ return new TesterResultSet(this, resultSetType, resultSetConcurrency);
}
@Override
@@ -202,19 +202,19 @@ public ResultSet executeQuery(final String sql) throws SQLException {
if ("null".equals(sql)) {
return null;
}
- return new TesterResultSet(this, _resultSetType, _resultSetConcurrency);
+ return new TesterResultSet(this, resultSetType, resultSetConcurrency);
}
@Override
public int executeUpdate() throws SQLException {
checkOpen();
- return (int) _rowsUpdated;
+ return (int) rowsUpdated;
}
@Override
public int executeUpdate(final String sql) throws SQLException {
checkOpen();
- return (int) _rowsUpdated;
+ return (int) rowsUpdated;
}
@Override
@@ -236,30 +236,30 @@ public int executeUpdate(final String sql, final String[] columnNames) throws SQ
}
public int getAutoGeneratedKeys() {
- return _autoGeneratedKeys;
+ return autoGeneratedKeys;
}
public String getCatalog() {
- return _catalog;
+ return catalog;
}
public int[] getColumnIndexes() {
- return _columnIndexes;
+ return columnIndexes;
}
public String[] getColumnNames() {
- return _columnNames;
+ return columnNames;
}
@Override
public ResultSet getGeneratedKeys() throws SQLException {
- return new TesterResultSet(this, _resultSetType, _resultSetConcurrency);
+ return new TesterResultSet(this, resultSetType, resultSetConcurrency);
}
@Override
public ResultSetMetaData getMetaData() throws SQLException {
checkOpen();
- return _resultSetMetaData;
+ return resultSetMetaData;
}
@Override
@@ -274,7 +274,7 @@ public java.sql.ParameterMetaData getParameterMetaData() throws SQLException {
/** For junit test only */
public String getSql() {
- return _sql;
+ return sql;
}
@Override
@@ -531,6 +531,6 @@ public void setURL(final int parameterIndex, final java.net.URL x) throws SQLExc
@Override
public String toString() {
- return _sql;
+ return sql;
}
}
diff --git a/src/test/java/org/apache/commons/dbcp2/TesterResultSet.java b/src/test/java/org/apache/commons/dbcp2/TesterResultSet.java
index dad25d5923..0150e26366 100644
--- a/src/test/java/org/apache/commons/dbcp2/TesterResultSet.java
+++ b/src/test/java/org/apache/commons/dbcp2/TesterResultSet.java
@@ -111,7 +111,7 @@ public void close() throws SQLException {
// Not all result sets are generated from statements eg DatabaseMetaData
if (_statement != null) {
- ((TesterStatement) _statement)._resultSet = null;
+ ((TesterStatement) _statement).resultSet = null;
}
_open = false;
diff --git a/src/test/java/org/apache/commons/dbcp2/TesterStatement.java b/src/test/java/org/apache/commons/dbcp2/TesterStatement.java
index 3357543ca8..0b6479c8fb 100644
--- a/src/test/java/org/apache/commons/dbcp2/TesterStatement.java
+++ b/src/test/java/org/apache/commons/dbcp2/TesterStatement.java
@@ -28,39 +28,39 @@
*/
public class TesterStatement extends AbandonedTrace implements Statement {
- protected final Connection _connection;
- protected boolean _open = true;
- protected final long _rowsUpdated = 1;
- protected final boolean _executeResponse = true;
- protected int _maxFieldSize = 1024;
- protected long _maxRows = 1024;
- protected boolean _escapeProcessing;
- protected int _queryTimeout = 1000;
- protected String _cursorName;
- protected int _fetchDirection = 1;
- protected int _fetchSize = 1;
- protected int _resultSetConcurrency = 1;
- protected int _resultSetType = 1;
- private int _resultSetHoldability = 1;
- protected ResultSet _resultSet;
- protected boolean _sqlExceptionOnClose;
-
- public TesterStatement(final Connection conn) {
- _connection = conn;
- }
-
- public TesterStatement(final Connection conn, final int resultSetType, final int resultSetConcurrency) {
- _connection = conn;
- _resultSetType = resultSetType;
- _resultSetConcurrency = resultSetConcurrency;
- }
-
- public TesterStatement(final Connection conn, final int resultSetType, final int resultSetConcurrency,
+ protected final Connection connection;
+ protected boolean open = true;
+ protected final long rowsUpdated = 1;
+ protected final boolean executeResponse = true;
+ protected int maxFieldSize = 1024;
+ protected long maxRows = 1024;
+ protected boolean escapeProcessing;
+ protected int queryTimeout = 1000;
+ protected String cursorName;
+ protected int fetchDirection = 1;
+ protected int fetchSize = 1;
+ protected int resultSetConcurrency = 1;
+ protected int resultSetType = 1;
+ private int resultSetHoldability = 1;
+ protected ResultSet resultSet;
+ protected boolean sqlExceptionOnClose;
+
+ public TesterStatement(final Connection connection) {
+ this.connection = connection;
+ }
+
+ public TesterStatement(final Connection connection, final int resultSetType, final int resultSetConcurrency) {
+ this.connection = connection;
+ this.resultSetType = resultSetType;
+ this.resultSetConcurrency = resultSetConcurrency;
+ }
+
+ public TesterStatement(final Connection connection, final int resultSetType, final int resultSetConcurrency,
final int resultSetHoldability) {
- _connection = conn;
- _resultSetType = resultSetType;
- _resultSetConcurrency = resultSetConcurrency;
- _resultSetHoldability = resultSetHoldability;
+ this.connection = connection;
+ this.resultSetType = resultSetType;
+ this.resultSetConcurrency = resultSetConcurrency;
+ this.resultSetHoldability = resultSetHoldability;
}
@Override
@@ -74,7 +74,7 @@ public void cancel() throws SQLException {
}
protected void checkOpen() throws SQLException {
- if (!_open) {
+ if (!open) {
throw new SQLException("Connection is closed.");
}
}
@@ -91,19 +91,19 @@ public void clearWarnings() throws SQLException {
@Override
public void close() throws SQLException {
- if (_sqlExceptionOnClose) {
+ if (sqlExceptionOnClose) {
throw new SQLException("TestSQLExceptionOnClose");
}
// calling close twice has no effect
- if (!_open) {
+ if (!open) {
return;
}
- _open = false;
- if (_resultSet != null) {
- _resultSet.close();
- _resultSet = null;
+ open = false;
+ if (resultSet != null) {
+ resultSet.close();
+ resultSet = null;
}
}
@@ -118,7 +118,7 @@ public boolean execute(final String sql) throws SQLException {
if ("invalid".equals(sql)) {
throw new SQLException("invalid query");
}
- return _executeResponse;
+ return executeResponse;
}
@Override
@@ -154,7 +154,7 @@ public long[] executeLargeBatch() throws SQLException {
@Override
public long executeLargeUpdate(final String sql) throws SQLException {
checkOpen();
- return _rowsUpdated;
+ return rowsUpdated;
}
@Override
@@ -185,12 +185,12 @@ public ResultSet executeQuery(final String sql) throws SQLException {
throw new SQLException("broken connection");
}
if ("select username".equals(sql)) {
- final String userName = ((TesterConnection) _connection).getUserName();
+ final String userName = ((TesterConnection) connection).getUserName();
final Object[][] data = { { userName } };
return new TesterResultSet(this, data);
}
// Simulate timeout if queryTimout is set to less than 5 seconds
- if (_queryTimeout > 0 && _queryTimeout < 5) {
+ if (queryTimeout > 0 && queryTimeout < 5) {
throw new SQLException("query timeout");
}
return new TesterResultSet(this);
@@ -199,7 +199,7 @@ public ResultSet executeQuery(final String sql) throws SQLException {
@Override
public int executeUpdate(final String sql) throws SQLException {
checkOpen();
- return (int) _rowsUpdated;
+ return (int) rowsUpdated;
}
@Override
@@ -220,19 +220,19 @@ public int executeUpdate(final String sql, final String[] columnNames) throws SQ
@Override
public Connection getConnection() throws SQLException {
checkOpen();
- return _connection;
+ return connection;
}
@Override
public int getFetchDirection() throws SQLException {
checkOpen();
- return _fetchDirection;
+ return fetchDirection;
}
@Override
public int getFetchSize() throws SQLException {
checkOpen();
- return _fetchSize;
+ return fetchSize;
}
@Override
@@ -243,25 +243,25 @@ public ResultSet getGeneratedKeys() throws SQLException {
@Override
public long getLargeMaxRows() throws SQLException {
checkOpen();
- return _maxRows;
+ return maxRows;
}
@Override
public long getLargeUpdateCount() throws SQLException {
checkOpen();
- return _rowsUpdated;
+ return rowsUpdated;
}
@Override
public int getMaxFieldSize() throws SQLException {
checkOpen();
- return _maxFieldSize;
+ return maxFieldSize;
}
@Override
public int getMaxRows() throws SQLException {
checkOpen();
- return (int) _maxRows;
+ return (int) maxRows;
}
@Override
@@ -278,40 +278,40 @@ public boolean getMoreResults(final int current) throws SQLException {
@Override
public int getQueryTimeout() throws SQLException {
checkOpen();
- return _queryTimeout;
+ return queryTimeout;
}
@Override
public ResultSet getResultSet() throws SQLException {
checkOpen();
- if (_resultSet == null) {
- _resultSet = new TesterResultSet(this);
+ if (resultSet == null) {
+ resultSet = new TesterResultSet(this);
}
- return _resultSet;
+ return resultSet;
}
@Override
public int getResultSetConcurrency() throws SQLException {
checkOpen();
- return _resultSetConcurrency;
+ return resultSetConcurrency;
}
@Override
public int getResultSetHoldability() throws SQLException {
checkOpen();
- return _resultSetHoldability;
+ return resultSetHoldability;
}
@Override
public int getResultSetType() throws SQLException {
checkOpen();
- return _resultSetType;
+ return resultSetType;
}
@Override
public int getUpdateCount() throws SQLException {
checkOpen();
- return (int) _rowsUpdated;
+ return (int) rowsUpdated;
}
@Override
@@ -322,7 +322,7 @@ public SQLWarning getWarnings() throws SQLException {
@Override
public boolean isClosed() throws SQLException {
- return !_open;
+ return !open;
}
@Override
@@ -336,7 +336,7 @@ public boolean isPoolable() throws SQLException {
}
public boolean isSqlExceptionOnClose() {
- return _sqlExceptionOnClose;
+ return sqlExceptionOnClose;
}
@Override
@@ -347,43 +347,43 @@ public boolean isWrapperFor(final Class> iface) throws SQLException {
@Override
public void setCursorName(final String name) throws SQLException {
checkOpen();
- _cursorName = name;
+ this.cursorName = name;
}
@Override
public void setEscapeProcessing(final boolean enable) throws SQLException {
checkOpen();
- _escapeProcessing = enable;
+ this.escapeProcessing = enable;
}
@Override
public void setFetchDirection(final int direction) throws SQLException {
checkOpen();
- _fetchDirection = direction;
+ this.fetchDirection = direction;
}
@Override
public void setFetchSize(final int rows) throws SQLException {
checkOpen();
- _fetchSize = rows;
+ this.fetchSize = rows;
}
@Override
public void setLargeMaxRows(final long max) throws SQLException {
checkOpen();
- _maxRows = max;
+ this.maxRows = max;
}
@Override
public void setMaxFieldSize(final int max) throws SQLException {
checkOpen();
- _maxFieldSize = max;
+ this.maxFieldSize = max;
}
@Override
public void setMaxRows(final int max) throws SQLException {
checkOpen();
- _maxRows = max;
+ this.maxRows = max;
}
@Override
@@ -394,11 +394,11 @@ public void setPoolable(final boolean poolable) throws SQLException {
@Override
public void setQueryTimeout(final int seconds) throws SQLException {
checkOpen();
- _queryTimeout = seconds;
+ this.queryTimeout = seconds;
}
public void setSqlExceptionOnClose(final boolean _sqlExceptionOnClose) {
- this._sqlExceptionOnClose = _sqlExceptionOnClose;
+ this.sqlExceptionOnClose = _sqlExceptionOnClose;
}
@Override
From 759a88c61618a713b6147931ea458a55d1ecdefb Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sun, 14 Jul 2024 12:50:23 -0400
Subject: [PATCH 018/169] Use import not FQCN
---
src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java | 2 +-
.../apache/commons/dbcp2/TestParallelCreationWithNoIdle.java | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java b/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java
index acee1c87b8..6376cca881 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java
@@ -164,7 +164,7 @@ public void stop() {
}
final class TestThread implements Runnable {
- final java.util.Random random = new java.util.Random();
+ final Random random = new Random();
boolean complete;
boolean failed;
int iter = 100;
diff --git a/src/test/java/org/apache/commons/dbcp2/TestParallelCreationWithNoIdle.java b/src/test/java/org/apache/commons/dbcp2/TestParallelCreationWithNoIdle.java
index 3b2ea0e1a6..48ea4aace6 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestParallelCreationWithNoIdle.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestParallelCreationWithNoIdle.java
@@ -26,6 +26,7 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import java.util.Random;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -36,7 +37,7 @@
public class TestParallelCreationWithNoIdle {
final class TestThread extends Thread {
- final java.util.Random random = new java.util.Random();
+ final Random random = new Random();
final int iter;
final int delay;
final int delayAfter;
From db958c7b6b53fc4d90b3761c9ef16417b021987e Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Wed, 17 Jul 2024 18:41:00 -0400
Subject: [PATCH 019/169] Bump org.apache.commons:commons-lang3 from 3.14.0 to
3.15.0 (#404)
Bumps org.apache.commons:commons-lang3 from 3.14.0 to 3.15.0.
---
updated-dependencies:
- dependency-name: org.apache.commons:commons-lang3
dependency-type: direct:development
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 4ad507fe57..b95d642d7c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -89,7 +89,7 @@
org.apache.commonscommons-lang3
- 3.14.0
+ 3.15.0test
From 583f269e913c3d84d2b8ec940c21c8b7b7e66ac3 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Wed, 17 Jul 2024 18:41:40 -0400
Subject: [PATCH 020/169] Bump org.apache.commons:commons-lang3 from 3.14.0 to
3.15.0 #404
---
src/changes/changes.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 8f3bef3451..532bd7b209 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -75,6 +75,7 @@ The type attribute can be add,update,fix,remove.
Bump org.apache.commons:commons-parent from 66 to 71 #360, #371, #395.Bump commons-logging:commons-logging from 1.3.0 to 1.3.3 #368, #399.
+ Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.15.0 #404.
From ee5d7a9e27f8c4212eb64d4cfe64fb95ec09a4e2 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 19 Jul 2024 00:25:10 -0400
Subject: [PATCH 021/169] Bump github/codeql-action from 3.25.11 to 3.25.12
(#405)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.25.11 to 3.25.12.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/b611370bb5703a7efb587f9d136a52ea24c5c38c...4fa2a7953630fd2f3fb380f21be14ede0169dd4f)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/codeql-analysis.yml | 6 +++---
.github/workflows/scorecards-analysis.yml | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 492ed75027..fe8dabbcef 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -57,7 +57,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
- uses: github/codeql-action/init@b611370bb5703a7efb587f9d136a52ea24c5c38c # 3.25.11
+ uses: github/codeql-action/init@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # 3.25.12
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -68,7 +68,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
- uses: github/codeql-action/autobuild@b611370bb5703a7efb587f9d136a52ea24c5c38c # 3.25.11
+ uses: github/codeql-action/autobuild@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # 3.25.12
# âšī¸ Command-line programs to run using the OS shell.
# đ https://git.io/JvXDl
@@ -82,4 +82,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@b611370bb5703a7efb587f9d136a52ea24c5c38c # 3.25.11
+ uses: github/codeql-action/analyze@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # 3.25.12
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index 9c3dcf97c1..381f78a949 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -64,6 +64,6 @@ jobs:
retention-days: 5
- name: "Upload to code-scanning"
- uses: github/codeql-action/upload-sarif@b611370bb5703a7efb587f9d136a52ea24c5c38c # 3.25.11
+ uses: github/codeql-action/upload-sarif@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # 3.25.12
with:
sarif_file: results.sarif
From da714d524d3b93939844e18e19b3959a725869dc Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sun, 21 Jul 2024 11:29:37 -0400
Subject: [PATCH 022/169] Javadoc
Use HTML 'em' tag instead of 'i' tag
---
.../org/apache/commons/dbcp2/cpdsadapter/DriverAdapterCPDS.java | 2 +-
.../java/org/apache/commons/dbcp2/managed/package-info.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/cpdsadapter/DriverAdapterCPDS.java b/src/main/java/org/apache/commons/dbcp2/cpdsadapter/DriverAdapterCPDS.java
index 481acaf355..6281592127 100644
--- a/src/main/java/org/apache/commons/dbcp2/cpdsadapter/DriverAdapterCPDS.java
+++ b/src/main/java/org/apache/commons/dbcp2/cpdsadapter/DriverAdapterCPDS.java
@@ -700,7 +700,7 @@ public void setMinEvictableIdleTimeMillis(final int minEvictableIdleTimeMillis)
*
* When a negative value is supplied,
* {@code ceil({@link BasicDataSource#getNumIdle})/abs({@link #getNumTestsPerEvictionRun})} tests will be run.
- * I.e., when the value is -n, roughly one nth of the idle objects will be tested per run.
+ * I.e., when the value is -n, roughly one nth of the idle objects will be tested per run.
*
*
* @param numTestsPerEvictionRun number of statements to examine per run
diff --git a/src/main/java/org/apache/commons/dbcp2/managed/package-info.java b/src/main/java/org/apache/commons/dbcp2/managed/package-info.java
index f0bc5210fe..7e613e7b9c 100644
--- a/src/main/java/org/apache/commons/dbcp2/managed/package-info.java
+++ b/src/main/java/org/apache/commons/dbcp2/managed/package-info.java
@@ -19,7 +19,7 @@
*
* This package provides support for pooling of ManagedConnections. A managed
* connection is responsible for managing a database connection in a
- * transactional environment (typically called Container Managed).
+ * transactional environment (typically called Container Managed).
* A managed connection operates like any other connection when no global
* transaction (a.k.a. XA transaction or JTA Transaction) is in progress.
* When a global transaction is active a single physical connection to the
From f5a4211e26d0842cb03c2c9d9a8b5e2e5b556c8c Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 22 Jul 2024 08:44:46 -0400
Subject: [PATCH 023/169] Add Java 22 to the GitHub CI build
---
.github/workflows/maven.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 65a377ca23..3c7f2ac814 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -27,7 +27,7 @@ jobs:
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
- java: [ 8, 11, 17, 21 ]
+ java: [ 8, 11, 17, 21, 22 ]
experimental: [false]
# include:
# - java: 22-ea
From 33762a662624d14a6645b0a4c2543851eedf1ae0 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 22 Jul 2024 08:45:02 -0400
Subject: [PATCH 024/169] Add Java 23-ea as an experimental build
---
.github/workflows/maven.yml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 3c7f2ac814..d383592eb1 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -29,9 +29,9 @@ jobs:
matrix:
java: [ 8, 11, 17, 21, 22 ]
experimental: [false]
-# include:
-# - java: 22-ea
-# experimental: true
+ include:
+ - java: 23-ea
+ experimental: true
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
From 51f3e985b54f2afe5ecf850af2bbf4395c261699 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 22 Jul 2024 08:50:11 -0400
Subject: [PATCH 025/169] Add Java 24-ea as an experimental build
---
.github/workflows/maven.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index d383592eb1..b2cf2b9d7b 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -32,6 +32,8 @@ jobs:
include:
- java: 23-ea
experimental: true
+ - java: 24-ea
+ experimental: true
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
From 8277232afe4ea0635cb9ab2525a1a60dcc116205 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 26 Jul 2024 00:39:47 -0400
Subject: [PATCH 026/169] Bump github/codeql-action from 3.25.12 to 3.25.14
(#406)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.25.12 to 3.25.14.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/4fa2a7953630fd2f3fb380f21be14ede0169dd4f...5cf07d8b700b67e235fbb65cbc84f69c0cf10464)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/codeql-analysis.yml | 6 +++---
.github/workflows/scorecards-analysis.yml | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index fe8dabbcef..43e10c73d6 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -57,7 +57,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
- uses: github/codeql-action/init@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # 3.25.12
+ uses: github/codeql-action/init@5cf07d8b700b67e235fbb65cbc84f69c0cf10464 # 3.25.14
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -68,7 +68,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
- uses: github/codeql-action/autobuild@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # 3.25.12
+ uses: github/codeql-action/autobuild@5cf07d8b700b67e235fbb65cbc84f69c0cf10464 # 3.25.14
# âšī¸ Command-line programs to run using the OS shell.
# đ https://git.io/JvXDl
@@ -82,4 +82,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # 3.25.12
+ uses: github/codeql-action/analyze@5cf07d8b700b67e235fbb65cbc84f69c0cf10464 # 3.25.14
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index 381f78a949..a69fb1b9d3 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -64,6 +64,6 @@ jobs:
retention-days: 5
- name: "Upload to code-scanning"
- uses: github/codeql-action/upload-sarif@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # 3.25.12
+ uses: github/codeql-action/upload-sarif@5cf07d8b700b67e235fbb65cbc84f69c0cf10464 # 3.25.14
with:
sarif_file: results.sarif
From 0b5ca3c50716ca136a532f92dc56bd1fb91f0305 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 26 Jul 2024 18:34:34 -0400
Subject: [PATCH 027/169] Remove useless comments
---
src/main/java/org/apache/commons/dbcp2/PoolingDataSource.java | 1 -
.../org/apache/commons/dbcp2/TestAbandonedBasicDataSource.java | 1 -
src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java | 1 -
3 files changed, 3 deletions(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/PoolingDataSource.java b/src/main/java/org/apache/commons/dbcp2/PoolingDataSource.java
index 1f7c0aa000..4762107e45 100644
--- a/src/main/java/org/apache/commons/dbcp2/PoolingDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/PoolingDataSource.java
@@ -164,7 +164,6 @@ public Connection getConnection(final String userName, final String password) th
throw new UnsupportedOperationException();
}
- // --- DataSource methods -----------------------------------------
/**
* Throws {@link UnsupportedOperationException}.
diff --git a/src/test/java/org/apache/commons/dbcp2/TestAbandonedBasicDataSource.java b/src/test/java/org/apache/commons/dbcp2/TestAbandonedBasicDataSource.java
index bdaac7803b..0f6232a490 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestAbandonedBasicDataSource.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestAbandonedBasicDataSource.java
@@ -53,7 +53,6 @@ private void assertAndReset(final DelegatingConnection> con) {
con.setLastUsed(Instant.EPOCH);
}
- // ---------- Abandoned Test -----------
/**
* Verifies that PreparedStatement executeXxx methods update lastUsed on the parent connection
diff --git a/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java b/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java
index 6376cca881..7f09aab92a 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java
@@ -232,7 +232,6 @@ public void run() {
/** Connections opened during the course of a test */
protected final Stack connectionStack = new Stack<>();
- // ----------- Utility Methods ---------------------------------
protected void assertBackPointers(final Connection conn, final Statement statement) throws SQLException {
assertFalse(conn.isClosed());
From 4124a54b96ff20cc9ebe61c91f93360d5bc04df3 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 29 Jul 2024 07:50:34 -0400
Subject: [PATCH 028/169] Use Javadoc @link
---
.../dbcp2/datasources/InstanceKeyDataSource.java | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java b/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java
index 9ec3451b27..636209522a 100644
--- a/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java
@@ -1109,18 +1109,15 @@ public void setLogWriter(final PrintWriter logWriter) {
/**
*
- * Sets the maximum permitted lifetime of a connection. A value of zero or less indicates an
- * infinite lifetime.
+ * Sets the maximum permitted lifetime of a connection. A value of zero or less indicates an infinite lifetime.
*
*
- * 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: getConnection, setLogwriter,
- * setLoginTimeout, getLoginTimeout, getLogWriter.
+ * 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: {@link #getConnection()}, {@link #setLogWriter(PrintWriter)}, {@link #setLoginTimeout(Duration)}, {@link #getLoginTimeoutDuration()},
+ * {@link #getLogWriter()}.
*
*
- * @param maxConnLifetimeMillis
- * The maximum permitted lifetime of a connection. A value of zero or less indicates an
- * infinite lifetime.
+ * @param maxConnLifetimeMillis The maximum permitted lifetime of a connection. A value of zero or less indicates an infinite lifetime.
* @since 2.9.0
*/
public void setMaxConnLifetime(final Duration maxConnLifetimeMillis) {
From e6ab6936df70f14eeea50f88360acb79a5aeb098 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 29 Jul 2024 07:51:29 -0400
Subject: [PATCH 029/169] Use Javadoc @link
---
.../dbcp2/datasources/InstanceKeyDataSource.java | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java b/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java
index 636209522a..4fd5ff293e 100644
--- a/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java
@@ -1126,18 +1126,15 @@ public void setMaxConnLifetime(final Duration maxConnLifetimeMillis) {
/**
*
- * Sets the maximum permitted lifetime of a connection in milliseconds. A value of zero or less indicates an
- * infinite lifetime.
+ * Sets the maximum permitted lifetime of a connection in milliseconds. A value of zero or less indicates an infinite lifetime.
*
*
- * 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: getConnection, setLogwriter,
- * setLoginTimeout, getLoginTimeout, getLogWriter.
+ * 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: {@link #getConnection()}, {@link #setLogWriter(PrintWriter)}, {@link #setLoginTimeout(Duration)}, {@link #getLoginTimeoutDuration()},
+ * {@link #getLogWriter()}.
*
*
- * @param maxConnLifetimeMillis
- * The maximum permitted lifetime of a connection in milliseconds. A value of zero or less indicates an
- * infinite lifetime.
+ * @param maxConnLifetimeMillis The maximum permitted lifetime of a connection in milliseconds. A value of zero or less indicates an infinite lifetime.
* @deprecated Use {@link #setMaxConnLifetime(Duration)}.
*/
@Deprecated
From 414974b6efce132bfa74e54184733468f8fefca5 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 29 Jul 2024 07:52:16 -0400
Subject: [PATCH 030/169] Use Javadoc @link
---
.../commons/dbcp2/managed/BasicManagedDataSource.java | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/managed/BasicManagedDataSource.java b/src/main/java/org/apache/commons/dbcp2/managed/BasicManagedDataSource.java
index 52570bea49..9f83f36e1a 100644
--- a/src/main/java/org/apache/commons/dbcp2/managed/BasicManagedDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/managed/BasicManagedDataSource.java
@@ -234,17 +234,14 @@ public synchronized void setXADataSource(final String xaDataSource) {
}
/**
- *
* Sets the XADataSource instance used by the XAConnectionFactory.
- *
*
- * 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: getConnection, setLogwriter,
- * setLoginTimeout, getLoginTimeout, getLogWriter.
+ * 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: {@link #getConnection()}, {@link #setLogWriter(java.io.PrintWriter)}, {@link #setLoginTimeout(int)}, {@link #getLoginTimeout()},
+ * {@link #getLogWriter()}.
*
* 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: getConnection, setLogwriter,
- * setLoginTimeout, getLoginTimeout, getLogWriter.
+ * time one of the following methods is invoked: {@link #getConnection()}, {@link #setLogWriter(PrintWriter)},
+ * {@link #setLoginTimeout(int)}, {@link #getLoginTimeout()}, {@link #getLogWriter()}.
*
*
* @param allow Access to the underlying connection is granted when true.
@@ -1786,8 +1786,8 @@ public void setConnectionFactoryClassName(final String connectionFactoryClassNam
* Sets the collection of SQL statements to be executed when a physical connection is first created.
*
* 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: getConnection, setLogwriter,
- * setLoginTimeout, getLoginTimeout, getLogWriter.
+ * time one of the following methods is invoked: {@link #getConnection()}, {@link #setLogWriter(PrintWriter)},
+ * {@link #setLoginTimeout(int)}, {@link #getLoginTimeout()}, {@link #getLogWriter()}.
*
*
* @param connectionInitSqls Collection of SQL statements to execute on connection creation
@@ -1802,8 +1802,8 @@ public void setConnectionInitSqls(final Collection connectionInitSqls) {
* Sets the list of SQL statements to be executed when a physical connection is first created.
*
* 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: getConnection, setLogwriter,
- * setLoginTimeout, getLoginTimeout, getLogWriter.
+ * time one of the following methods is invoked: {@link #getConnection()}, {@link #setLogWriter(PrintWriter)},
+ * {@link #setLoginTimeout(int)}, {@link #getLoginTimeout()}, {@link #getLogWriter()}.
*
*
* @param connectionInitSqls List of SQL statements to execute on connection creation
@@ -1853,8 +1853,8 @@ public void setConnectionProperties(final String connectionProperties) {
* Sets default auto-commit state of connections returned by this datasource.
*
* 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: getConnection, setLogwriter,
- * setLoginTimeout, getLoginTimeout, getLogWriter.
+ * time one of the following methods is invoked: {@link #getConnection()}, {@link #setLogWriter(PrintWriter)},
+ * {@link #setLoginTimeout(int)}, {@link #getLoginTimeout()}, {@link #getLogWriter()}.
*
*
* @param defaultAutoCommit default auto-commit value
@@ -1867,8 +1867,8 @@ public void setDefaultAutoCommit(final Boolean defaultAutoCommit) {
* Sets the default catalog.
*
* 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: getConnection, setLogwriter,
- * setLoginTimeout, getLoginTimeout, getLogWriter.
+ * time one of the following methods is invoked: {@link #getConnection()}, {@link #setLogWriter(PrintWriter)},
+ * {@link #setLoginTimeout(int)}, {@link #getLoginTimeout()}, {@link #getLogWriter()}.
*
* 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: getConnection, setLogwriter,
- * setLoginTimeout, getLoginTimeout, getLogWriter.
+ * time one of the following methods is invoked: {@link #getConnection()}, {@link #setLogWriter(PrintWriter)},
+ * {@link #setLoginTimeout(int)}, {@link #getLoginTimeout()}, {@link #getLogWriter()}.
*
*
* @param defaultReadOnly default read-only value
@@ -1918,8 +1918,8 @@ public void setDefaultReadOnly(final Boolean defaultReadOnly) {
* Sets the default schema.
*
* 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: getConnection, setLogwriter,
- * setLoginTimeout, getLoginTimeout, getLogWriter.
+ * time one of the following methods is invoked: {@link #getConnection()}, {@link #setLogWriter(PrintWriter)},
+ * {@link #setLoginTimeout(int)}, {@link #getLoginTimeout()}, {@link #getLogWriter()}.
*
*
* @param defaultSchema the default catalog
@@ -1933,8 +1933,8 @@ public void setDefaultSchema(final String defaultSchema) {
* Sets the default transaction isolation state for returned connections.
*
* 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: getConnection, setLogwriter,
- * setLoginTimeout, getLoginTimeout, getLogWriter.
+ * time one of the following methods is invoked: {@link #getConnection()}, {@link #setLogWriter(PrintWriter)},
+ * {@link #setLoginTimeout(int)}, {@link #getLoginTimeout()}, {@link #getLogWriter()}.
*
*
* @param defaultTransactionIsolation the default transaction isolation state
@@ -1975,8 +1975,8 @@ public void setDisconnectionSqlCodes(final Collection disconnectionSqlCo
* Sets the JDBC Driver instance to use for this pool.
*
* 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: getConnection, setLogwriter,
- * setLoginTimeout, getLoginTimeout, getLogWriter.
+ * time one of the following methods is invoked: {@link #getConnection()}, {@link #setLogWriter(PrintWriter)},
+ * {@link #setLoginTimeout(int)}, {@link #getLoginTimeout()}, {@link #getLogWriter()}.
*
*
* @param driver The JDBC Driver instance to use for this pool.
@@ -1989,8 +1989,8 @@ public synchronized void setDriver(final Driver driver) {
* Sets the class loader to be used to load the JDBC driver.
*
* 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: getConnection, setLogwriter,
- * setLoginTimeout, getLoginTimeout, getLogWriter.
+ * time one of the following methods is invoked: {@link #getConnection()}, {@link #setLogWriter(PrintWriter)},
+ * {@link #setLoginTimeout(int)}, {@link #getLoginTimeout()}, {@link #getLogWriter()}.
*
*
* @param driverClassLoader the class loader with which to load the JDBC driver
@@ -2003,8 +2003,8 @@ public synchronized void setDriverClassLoader(final ClassLoader driverClassLoade
* Sets the JDBC driver class name.
*
* 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: getConnection, setLogwriter,
- * setLoginTimeout, getLoginTimeout, getLogWriter.
+ * time one of the following methods is invoked: {@link #getConnection()}, {@link #setLogWriter(PrintWriter)},
+ * {@link #setLoginTimeout(int)}, {@link #getLoginTimeout()}, {@link #getLogWriter()}.
*
*
* @param driverClassName the class name of the JDBC driver
@@ -2062,8 +2062,8 @@ public void setFastFailValidation(final boolean fastFailValidation) {
* Sets the initial size of the connection pool.
*
* 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: getConnection, setLogwriter,
- * setLoginTimeout, getLoginTimeout, getLogWriter.
+ * time one of the following methods is invoked: {@link #getConnection()}, {@link #setLogWriter(PrintWriter)},
+ * {@link #setLoginTimeout(int)}, {@link #getLoginTimeout()}, {@link #getLogWriter()}.
*
*
* @param initialSize the number of connections created when the pool is initialized
@@ -2155,8 +2155,8 @@ public void setLogWriter(final PrintWriter logWriter) throws SQLException {
* infinite lifetime.
*
* 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: getConnection, setLogwriter,
- * setLoginTimeout, getLoginTimeout, getLogWriter.
+ * time one of the following methods is invoked: {@link #getConnection()}, {@link #setLogWriter(PrintWriter)},
+ * {@link #setLoginTimeout(int)}, {@link #getLoginTimeout()}, {@link #getLogWriter()}.
*
*
* @param maxConnDuration The maximum permitted lifetime of a connection.
@@ -2171,8 +2171,8 @@ public void setMaxConn(final Duration maxConnDuration) {
* infinite lifetime.
*
* 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: getConnection, setLogwriter,
- * setLoginTimeout, getLoginTimeout, getLogWriter.
+ * time one of the following methods is invoked: {@link #getConnection()}, {@link #setLogWriter(PrintWriter)},
+ * {@link #setLoginTimeout(int)}, {@link #getLoginTimeout()}, {@link #getLogWriter()}.
*
*
* @param maxConnLifetimeMillis The maximum permitted lifetime of a connection in milliseconds.
@@ -2199,8 +2199,8 @@ public synchronized void setMaxIdle(final int maxIdle) {
* Sets the value of the {@code maxOpenPreparedStatements} property.
*
* 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: getConnection, setLogwriter,
- * setLoginTimeout, getLoginTimeout, getLogWriter.
+ * time one of the following methods is invoked: {@link #getConnection()}, {@link #setLogWriter(PrintWriter)},
+ * {@link #setLoginTimeout(int)}, {@link #getLoginTimeout()}, {@link #getLogWriter()}.
*
*
* @param maxOpenStatements the new maximum number of prepared statements
@@ -2297,8 +2297,8 @@ public synchronized void setNumTestsPerEvictionRun(final int numTestsPerEviction
* Sets the {code password}.
*
* 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: getConnection, setLogwriter,
- * setLoginTimeout, getLoginTimeout, getLogWriter.
+ * time one of the following methods is invoked: {@link #getConnection()}, {@link #setLogWriter(PrintWriter)},
+ * {@link #setLoginTimeout(int)}, {@link #getLoginTimeout()}, {@link #getLogWriter()}.
*
*
* @param password new value for the password
@@ -2311,8 +2311,8 @@ public void setPassword(final String password) {
* Sets whether to pool statements or not.
*
* 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: getConnection, setLogwriter,
- * setLoginTimeout, getLoginTimeout, getLogWriter.
+ * time one of the following methods is invoked: {@link #getConnection()}, {@link #setLogWriter(PrintWriter)},
+ * {@link #setLoginTimeout(int)}, {@link #getLoginTimeout()}, {@link #getLogWriter()}.
*
*
* @param poolingStatements pooling on or off
@@ -2483,8 +2483,8 @@ public synchronized void setTimeBetweenEvictionRunsMillis(final long timeBetween
* Sets the {code connection string}.
*
* 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: getConnection, setLogwriter,
- * setLoginTimeout, getLoginTimeout, getLogWriter.
+ * time one of the following methods is invoked: {@link #getConnection()}, {@link #setLogWriter(PrintWriter)},
+ * {@link #setLoginTimeout(int)}, {@link #getLoginTimeout()}, {@link #getLogWriter()}.
*
*
* @param connectionString the new value for the JDBC connection connectionString
@@ -2497,8 +2497,8 @@ public synchronized void setUrl(final String connectionString) {
* Sets the {code userName}.
*
* 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: getConnection, setLogwriter,
- * setLoginTimeout, getLoginTimeout, getLogWriter.
+ * time one of the following methods is invoked: {@link #getConnection()}, {@link #setLogWriter(PrintWriter)},
+ * {@link #setLoginTimeout(int)}, {@link #getLoginTimeout()}, {@link #getLogWriter()}.
*
*
* @param userName the new value for the JDBC connection user name
@@ -2511,8 +2511,8 @@ public void setUsername(final String userName) {
* Sets the {code validationQuery}.
*
* 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: getConnection, setLogwriter,
- * setLoginTimeout, getLoginTimeout, getLogWriter.
+ * time one of the following methods is invoked: {@link #getConnection()}, {@link #setLogWriter(PrintWriter)},
+ * {@link #setLoginTimeout(int)}, {@link #getLoginTimeout()}, {@link #getLogWriter()}.
*
*
* @param validationQuery the new value for the validation query
@@ -2526,8 +2526,8 @@ public void setValidationQuery(final String validationQuery) {
* response from the database when executing a validation query. Use a value less than or equal to 0 for no timeout.
*
* 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: getConnection, setLogwriter,
- * setLoginTimeout, getLoginTimeout, getLogWriter.
+ * time one of the following methods is invoked: {@link #getConnection()}, {@link #setLogWriter(PrintWriter)},
+ * {@link #setLoginTimeout(int)}, {@link #getLoginTimeout()}, {@link #getLogWriter()}.
*
*
* @param validationQueryTimeoutDuration new validation query timeout value in seconds
@@ -2542,8 +2542,8 @@ public void setValidationQueryTimeout(final Duration validationQueryTimeoutDurat
* response from the database when executing a validation query. Use a value less than or equal to 0 for no timeout.
*
* 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: getConnection, setLogwriter,
- * setLoginTimeout, getLoginTimeout, getLogWriter.
+ * time one of the following methods is invoked: {@link #getConnection()}, {@link #setLogWriter(PrintWriter)},
+ * {@link #setLoginTimeout(int)}, {@link #getLoginTimeout()}, {@link #getLogWriter()}.
*
*
* @param validationQueryTimeoutSeconds new validation query timeout value in seconds
diff --git a/src/main/java/org/apache/commons/dbcp2/managed/BasicManagedDataSource.java b/src/main/java/org/apache/commons/dbcp2/managed/BasicManagedDataSource.java
index 9f83f36e1a..719ee4d09c 100644
--- a/src/main/java/org/apache/commons/dbcp2/managed/BasicManagedDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/managed/BasicManagedDataSource.java
@@ -238,7 +238,7 @@ public synchronized void setXADataSource(final String xaDataSource) {
*
* 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: {@link #getConnection()}, {@link #setLogWriter(java.io.PrintWriter)}, {@link #setLoginTimeout(int)}, {@link #getLoginTimeout()},
- * {@link #getLogWriter()}.
+ * {@link #getLogWriter()}.
*
From a2f666715236d2a9f1d4d769ba2564e3d0c3defe Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Tue, 30 Jul 2024 08:52:05 -0400
Subject: [PATCH 033/169] Bump org.apache.commons:commons-parent from 71 to 72
---
pom.xml | 2 +-
src/changes/changes.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index b95d642d7c..88aa62385f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
org.apache.commonscommons-parent
- 71
+ 724.0.0commons-dbcp2
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 532bd7b209..cb45e464ff 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -73,7 +73,7 @@ The type attribute can be add,update,fix,remove.
Fix SpotBugs MC_OVERRIDABLE_METHOD_CALL_IN_READ_OBJECT in SharedPoolDataSource.
- Bump org.apache.commons:commons-parent from 66 to 71 #360, #371, #395.
+ Bump org.apache.commons:commons-parent from 66 to 72 #360, #371, #395.Bump commons-logging:commons-logging from 1.3.0 to 1.3.3 #368, #399.Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.15.0 #404.
From 560ffccc48095c9706cdad3b2379afeb8a1b5fe3 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 2 Aug 2024 08:12:40 -0400
Subject: [PATCH 034/169] Bump org.hamcrest:hamcrest from 2.2 to 3.0 (#409)
Bumps [org.hamcrest:hamcrest](https://github.com/hamcrest/JavaHamcrest) from 2.2 to 3.0.
- [Release notes](https://github.com/hamcrest/JavaHamcrest/releases)
- [Changelog](https://github.com/hamcrest/JavaHamcrest/blob/master/CHANGES.md)
- [Commits](https://github.com/hamcrest/JavaHamcrest/compare/v2.2...v3.0)
---
updated-dependencies:
- dependency-name: org.hamcrest:hamcrest
dependency-type: direct:development
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 88aa62385f..58f2a10162 100644
--- a/pom.xml
+++ b/pom.xml
@@ -75,7 +75,7 @@
org.hamcresthamcrest
- 2.2
+ 3.0test
From 27a7818eb1d122af60538459e8daf7eee190a955 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 2 Aug 2024 08:13:19 -0400
Subject: [PATCH 035/169] Bump org.hamcrest:hamcrest from 2.2 to 3.0 #409
---
src/changes/changes.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index cb45e464ff..672e71b8a7 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -76,6 +76,7 @@ The type attribute can be add,update,fix,remove.
Bump org.apache.commons:commons-parent from 66 to 72 #360, #371, #395.Bump commons-logging:commons-logging from 1.3.0 to 1.3.3 #368, #399.Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.15.0 #404.
+ Bump org.hamcrest:hamcrest from 2.2 to 3.0 #409.
From c9cfd334fdc7685493f15d1e6d46b0874eaee7f5 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 2 Aug 2024 08:13:42 -0400
Subject: [PATCH 036/169] Bump ossf/scorecard-action from 2.3.3 to 2.4.0 (#408)
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.3.3 to 2.4.0.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](https://github.com/ossf/scorecard-action/compare/dc50aa9510b46c811795eb24b2f1ba02a914e534...62b2cac7ed8198b15735ed49ab1e5cf35480ba46)
---
updated-dependencies:
- dependency-name: ossf/scorecard-action
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/scorecards-analysis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index a69fb1b9d3..557283e35f 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -45,7 +45,7 @@ jobs:
persist-credentials: false
- name: "Run analysis"
- uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534 # 2.3.3
+ uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # 2.4.0
with:
results_file: results.sarif
results_format: sarif
From 80e023778edace2aa25e5e748ac351b0d5989968 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 2 Aug 2024 10:09:43 -0400
Subject: [PATCH 037/169] Put Hamcreset last on the classpath
Local build OK without this but fails on GitHub
---
pom.xml | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/pom.xml b/pom.xml
index 58f2a10162..999290c92f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -72,13 +72,6 @@
test
-
- org.hamcrest
- hamcrest
- 3.0
- test
-
-
org.mockitomockito-core
@@ -170,6 +163,12 @@
3.4.3.Finaltest
+
+ org.hamcrest
+ hamcrest
+ 3.0
+ test
+
From 3ae4669c9c70998e45027db37b8054cf9a5aa1ca Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 2 Aug 2024 10:52:30 -0400
Subject: [PATCH 038/169] Undo bump org.hamcrest:hamcrest from 2.2 to 3.0
OK locally but not on GitHub?
---
pom.xml | 2 +-
src/changes/changes.xml | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 999290c92f..20b703d8ca 100644
--- a/pom.xml
+++ b/pom.xml
@@ -166,7 +166,7 @@
org.hamcresthamcrest
- 3.0
+ 2.0test
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 672e71b8a7..cb45e464ff 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -76,7 +76,6 @@ The type attribute can be add,update,fix,remove.
Bump org.apache.commons:commons-parent from 66 to 72 #360, #371, #395.Bump commons-logging:commons-logging from 1.3.0 to 1.3.3 #368, #399.Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.15.0 #404.
- Bump org.hamcrest:hamcrest from 2.2 to 3.0 #409.
From 7cd898c8e9a027e68c8802be1bd4f3d0c1cb3460 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 2 Aug 2024 10:56:52 -0400
Subject: [PATCH 039/169] Undo bump org.hamcrest:hamcrest from 2.2 to 3.0
OK locally but not on GitHub?
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 20b703d8ca..e82fdd936c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -166,7 +166,7 @@
org.hamcresthamcrest
- 2.0
+ 2.2test
From 54e94fde1c12c25ee59fa671d3e14d2f0f87db3c Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 2 Aug 2024 11:00:51 -0400
Subject: [PATCH 040/169] Bump github/codeql-action from 3.25.14 to 3.25.15
(#407)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.25.14 to 3.25.15.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/5cf07d8b700b67e235fbb65cbc84f69c0cf10464...afb54ba388a7dca6ecae48f608c4ff05ff4cc77a)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/codeql-analysis.yml | 6 +++---
.github/workflows/scorecards-analysis.yml | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 43e10c73d6..bc8bcc758b 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -57,7 +57,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
- uses: github/codeql-action/init@5cf07d8b700b67e235fbb65cbc84f69c0cf10464 # 3.25.14
+ uses: github/codeql-action/init@afb54ba388a7dca6ecae48f608c4ff05ff4cc77a # 3.25.15
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -68,7 +68,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
- uses: github/codeql-action/autobuild@5cf07d8b700b67e235fbb65cbc84f69c0cf10464 # 3.25.14
+ uses: github/codeql-action/autobuild@afb54ba388a7dca6ecae48f608c4ff05ff4cc77a # 3.25.15
# âšī¸ Command-line programs to run using the OS shell.
# đ https://git.io/JvXDl
@@ -82,4 +82,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@5cf07d8b700b67e235fbb65cbc84f69c0cf10464 # 3.25.14
+ uses: github/codeql-action/analyze@afb54ba388a7dca6ecae48f608c4ff05ff4cc77a # 3.25.15
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index 557283e35f..b7e502326d 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -64,6 +64,6 @@ jobs:
retention-days: 5
- name: "Upload to code-scanning"
- uses: github/codeql-action/upload-sarif@5cf07d8b700b67e235fbb65cbc84f69c0cf10464 # 3.25.14
+ uses: github/codeql-action/upload-sarif@afb54ba388a7dca6ecae48f608c4ff05ff4cc77a # 3.25.15
with:
sarif_file: results.sarif
From 2a4e520c913f047174206e74b58a9310a0b45751 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 3 Aug 2024 07:25:18 -0400
Subject: [PATCH 041/169] Try a different way to initial tests for GitHub
failures
---
.../commons/dbcp2/AbstractDriverTest.java | 45 +++++++++++++++++++
.../TestDriverManagerConnectionFactory.java | 16 +------
.../apache/commons/dbcp2/TesterDriver.java | 4 ++
3 files changed, 50 insertions(+), 15 deletions(-)
create mode 100644 src/test/java/org/apache/commons/dbcp2/AbstractDriverTest.java
diff --git a/src/test/java/org/apache/commons/dbcp2/AbstractDriverTest.java b/src/test/java/org/apache/commons/dbcp2/AbstractDriverTest.java
new file mode 100644
index 0000000000..b1f28dac91
--- /dev/null
+++ b/src/test/java/org/apache/commons/dbcp2/AbstractDriverTest.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.dbcp2;
+
+import java.sql.DriverManager;
+import java.sql.SQLException;
+
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+
+/**
+ * Abstracts testing a JDBC driver.
+ */
+public abstract class AbstractDriverTest {
+
+ //private static final String KEY_JDBC_DRIVERS = "jdbc.drivers";
+
+ @AfterAll
+ public static void afterClass() throws SQLException {
+ //System.clearProperty(KEY_JDBC_DRIVERS);
+ DriverManager.deregisterDriver(TesterDriver.INSTANCE);
+ }
+
+ @BeforeAll
+ public static void beforeClass() throws SQLException {
+ //System.setProperty(KEY_JDBC_DRIVERS, "org.apache.commons.dbcp2.TesterDriver");
+ DriverManager.registerDriver(TesterDriver.INSTANCE);
+ }
+
+}
diff --git a/src/test/java/org/apache/commons/dbcp2/TestDriverManagerConnectionFactory.java b/src/test/java/org/apache/commons/dbcp2/TestDriverManagerConnectionFactory.java
index 673f4bb162..ce6b368c9d 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestDriverManagerConnectionFactory.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestDriverManagerConnectionFactory.java
@@ -28,8 +28,6 @@
import org.apache.commons.pool2.impl.GenericObjectPool;
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
/**
@@ -37,7 +35,7 @@
* the initialization of DriverManager.
* Based on the test case for DBCP-212 written by Marcos Sanz
*/
-public class TestDriverManagerConnectionFactory {
+public class TestDriverManagerConnectionFactory extends AbstractDriverTest {
private static final class ConnectionThread implements Runnable {
private final DataSource ds;
@@ -77,18 +75,6 @@ public String toString() {
}
}
- private static final String KEY_JDBC_DRIVERS = "jdbc.drivers";
-
- @AfterAll
- public static void afterClass() {
- System.clearProperty(KEY_JDBC_DRIVERS);
- }
-
- @BeforeAll
- public static void beforeClass() {
- System.setProperty(KEY_JDBC_DRIVERS, "org.apache.commons.dbcp2.TesterDriver");
- }
-
@Test
public void testDriverManagerCredentialsInUrl() throws SQLException {
final DriverManagerConnectionFactory cf = new DriverManagerConnectionFactory("jdbc:apache:commons:testdriver;user=foo;password=bar", null, (char[]) null);
diff --git a/src/test/java/org/apache/commons/dbcp2/TesterDriver.java b/src/test/java/org/apache/commons/dbcp2/TesterDriver.java
index 6f2c18623e..5f3c71fab6 100644
--- a/src/test/java/org/apache/commons/dbcp2/TesterDriver.java
+++ b/src/test/java/org/apache/commons/dbcp2/TesterDriver.java
@@ -40,7 +40,11 @@
*
*/
public class TesterDriver implements Driver {
+
+ static TesterDriver INSTANCE = new TesterDriver();
+
private static final Properties validUserPasswords = new Properties();
+
static {
try {
DriverManager.registerDriver(new TesterDriver());
From 082ded3c409bdac13dd8d8d20bb7d51dff5d6f6c Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 3 Aug 2024 07:29:06 -0400
Subject: [PATCH 042/169] Use assertThrows()
Longer lines
---
.../commons/dbcp2/TestPoolableConnection.java | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/src/test/java/org/apache/commons/dbcp2/TestPoolableConnection.java b/src/test/java/org/apache/commons/dbcp2/TestPoolableConnection.java
index 3a9f2e2ac0..30611d8c0e 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestPoolableConnection.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestPoolableConnection.java
@@ -19,6 +19,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.fail;
import java.sql.Connection;
@@ -42,9 +43,7 @@ public class TestPoolableConnection {
@BeforeEach
public void setUp() throws Exception {
final PoolableConnectionFactory factory = new PoolableConnectionFactory(
- new DriverConnectionFactory(
- new TesterDriver(),"jdbc:apache:commons:testdriver", null),
- null);
+ new DriverConnectionFactory(new TesterDriver(), "jdbc:apache:commons:testdriver", null), null);
factory.setDefaultAutoCommit(Boolean.TRUE);
factory.setDefaultReadOnly(Boolean.TRUE);
@@ -149,14 +148,9 @@ public void testFastFailValidationCustomCodes() throws Exception {
// Set up fatal exception
nativeConnection.setFailure(new SQLException("Fatal connection error.", "XXX"));
-
- try {
- conn.createStatement();
- fail("Should throw SQL exception.");
- } catch (final SQLException ignored) {
- // cleanup failure
- nativeConnection.setFailure(null);
- }
+ assertThrows(SQLException.class, conn::createStatement);
+ // cleanup failure
+ nativeConnection.setFailure(null);
// verify that bad connection does not get returned to the pool
conn.close(); // testOnReturn triggers validate, which should fail
From 01d4211b29376c85ee0de4934f40a3834718f184 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Sat, 3 Aug 2024 07:37:23 -0400
Subject: [PATCH 043/169] Bump org.hamcrest:hamcrest from 2.2 to 3.0 (#410)
Bumps [org.hamcrest:hamcrest](https://github.com/hamcrest/JavaHamcrest) from 2.2 to 3.0.
- [Release notes](https://github.com/hamcrest/JavaHamcrest/releases)
- [Changelog](https://github.com/hamcrest/JavaHamcrest/blob/master/CHANGES.md)
- [Commits](https://github.com/hamcrest/JavaHamcrest/compare/v2.2...v3.0)
---
updated-dependencies:
- dependency-name: org.hamcrest:hamcrest
dependency-type: direct:development
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index e82fdd936c..999290c92f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -166,7 +166,7 @@
org.hamcresthamcrest
- 2.2
+ 3.0test
From ffe8d43deed0a77e2d53e8866798b1fea10f62e2 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 3 Aug 2024 07:38:02 -0400
Subject: [PATCH 044/169] Bump org.hamcrest:hamcrest from 2.2 to 3.0 #410
---
src/changes/changes.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index cb45e464ff..12ce5041f5 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -76,6 +76,7 @@ The type attribute can be add,update,fix,remove.
Bump org.apache.commons:commons-parent from 66 to 72 #360, #371, #395.Bump commons-logging:commons-logging from 1.3.0 to 1.3.3 #368, #399.Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.15.0 #404.
+ Bump org.hamcrest:hamcrest from 2.2 to 3.0 #410.
From 49fa99ae08766e3e332963f408b7a361cc541765 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 3 Aug 2024 07:38:23 -0400
Subject: [PATCH 045/169] Use assertThrows()
---
.../cpdsadapter/TestDriverAdapterCPDS.java | 27 +++++--------------
1 file changed, 6 insertions(+), 21 deletions(-)
diff --git a/src/test/java/org/apache/commons/dbcp2/cpdsadapter/TestDriverAdapterCPDS.java b/src/test/java/org/apache/commons/dbcp2/cpdsadapter/TestDriverAdapterCPDS.java
index 6fc6042f1d..68573f42e4 100644
--- a/src/test/java/org/apache/commons/dbcp2/cpdsadapter/TestDriverAdapterCPDS.java
+++ b/src/test/java/org/apache/commons/dbcp2/cpdsadapter/TestDriverAdapterCPDS.java
@@ -290,30 +290,15 @@ public void testGettersAndSetters() {
* JIRA: DBCP-245
*/
@Test
- public void testIncorrectPassword() throws Exception
- {
+ public void testIncorrectPassword() throws Exception {
pcds.getPooledConnection("u2", "p2").close();
- try {
- // Use bad password
- pcds.getPooledConnection("u1", "zlsafjk");
- fail("Able to retrieve connection with incorrect password");
- } catch (final SQLException e1) {
- // should fail
-
- }
+ // Use bad password
+ assertThrows(SQLException.class, () -> pcds.getPooledConnection("u1", "zlsafjk"), "Able to retrieve connection with incorrect password");
// Use good password
- pcds.getPooledConnection("u1", "p1").close();
- try {
- pcds.getPooledConnection("u1", "x");
- fail("Able to retrieve connection with incorrect password");
- }
- catch (final SQLException e) {
- if (!e.getMessage().startsWith("x is not the correct password")) {
- throw e;
- }
- // else the exception was expected
- }
+ SQLException e = assertThrows(SQLException.class, () -> pcds.getPooledConnection("u1", "x"), "Able to retrieve connection with incorrect password");
+ assertTrue(e.getMessage().startsWith("x is not the correct password"));
+ // else the exception was expected
// Make sure we can still use our good password.
pcds.getPooledConnection("u1", "p1").close();
From a03b858896eee3fb417a2b29db61c04e607c642d Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 3 Aug 2024 07:40:30 -0400
Subject: [PATCH 046/169] Use assertThrows()
Longer lines
---
.../TestPerUserPoolDataSource.java | 25 ++++++++-----------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/src/test/java/org/apache/commons/dbcp2/datasources/TestPerUserPoolDataSource.java b/src/test/java/org/apache/commons/dbcp2/datasources/TestPerUserPoolDataSource.java
index 529c6beb71..9cfc774dc8 100644
--- a/src/test/java/org/apache/commons/dbcp2/datasources/TestPerUserPoolDataSource.java
+++ b/src/test/java/org/apache/commons/dbcp2/datasources/TestPerUserPoolDataSource.java
@@ -90,7 +90,9 @@ public void tearDown() throws Exception {
((PerUserPoolDataSource) ds).close();
}
- // See DBCP-8
+ /**
+ * See DBCP-8
+ */
@Test
public void testChangePassword() throws Exception {
assertThrows(SQLException.class, () -> ds.getConnection(user, "bay"));
@@ -99,28 +101,23 @@ public void testChangePassword() throws Exception {
final Connection con3 = ds.getConnection(user, "bar");
con1.close();
con2.close();
- TesterDriver.addUser(user,"bay"); // change the user/password setting
+ TesterDriver.addUser(user, "bay"); // change the user/password setting
try {
final Connection con4 = ds.getConnection(user, "bay"); // new password
// Idle instances with old password should have been cleared
- assertEquals(0, ((PerUserPoolDataSource) ds).getNumIdle(user),
- "Should be no idle connections in the pool");
+ assertEquals(0, ((PerUserPoolDataSource) ds).getNumIdle(user), "Should be no idle connections in the pool");
con4.close();
// Should be one idle instance with new pwd
- assertEquals(1, ((PerUserPoolDataSource) ds).getNumIdle(user),
- "Should be one idle connection in the pool");
- try (Connection c = ds.getConnection(user, "bar")) { // old password
- fail("Should have generated SQLException");
- } catch (final SQLException expected) {
- }
+ assertEquals(1, ((PerUserPoolDataSource) ds).getNumIdle(user), "Should be one idle connection in the pool");
+ // old password
+ assertThrows(SQLException.class, () -> ds.getConnection(user, "bar"), "Should have generated SQLException");
final Connection con5 = ds.getConnection(user, "bay"); // take the idle one
con3.close(); // Return a connection with the old password
- ds.getConnection(user, "bay").close(); // will try bad returned connection and destroy it
- assertEquals(1, ((PerUserPoolDataSource) ds).getNumIdle(user),
- "Should be one idle connection in the pool");
+ ds.getConnection(user, "bay").close(); // will try bad returned connection and destroy it
+ assertEquals(1, ((PerUserPoolDataSource) ds).getNumIdle(user), "Should be one idle connection in the pool");
con5.close();
} finally {
- TesterDriver.addUser(user,"bar");
+ TesterDriver.addUser(user, "bar");
}
}
From 5a2f73466e64e410d314db89e858867af8422108 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 3 Aug 2024 07:41:05 -0400
Subject: [PATCH 047/169] Use try-with-resources
---
.../dbcp2/datasources/TestPerUserPoolDataSource.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/test/java/org/apache/commons/dbcp2/datasources/TestPerUserPoolDataSource.java b/src/test/java/org/apache/commons/dbcp2/datasources/TestPerUserPoolDataSource.java
index 9cfc774dc8..d74edc9fd8 100644
--- a/src/test/java/org/apache/commons/dbcp2/datasources/TestPerUserPoolDataSource.java
+++ b/src/test/java/org/apache/commons/dbcp2/datasources/TestPerUserPoolDataSource.java
@@ -111,11 +111,11 @@ public void testChangePassword() throws Exception {
assertEquals(1, ((PerUserPoolDataSource) ds).getNumIdle(user), "Should be one idle connection in the pool");
// old password
assertThrows(SQLException.class, () -> ds.getConnection(user, "bar"), "Should have generated SQLException");
- final Connection con5 = ds.getConnection(user, "bay"); // take the idle one
- con3.close(); // Return a connection with the old password
- ds.getConnection(user, "bay").close(); // will try bad returned connection and destroy it
- assertEquals(1, ((PerUserPoolDataSource) ds).getNumIdle(user), "Should be one idle connection in the pool");
- con5.close();
+ try (Connection con5 = ds.getConnection(user, "bay")) { // take the idle one
+ con3.close(); // Return a connection with the old password
+ ds.getConnection(user, "bay").close(); // will try bad returned connection and destroy it
+ assertEquals(1, ((PerUserPoolDataSource) ds).getNumIdle(user), "Should be one idle connection in the pool");
+ }
} finally {
TesterDriver.addUser(user, "bar");
}
From 4a7a6576af829fc08a8cfd5d933866ab96f35466 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Tue, 6 Aug 2024 08:39:19 -0400
Subject: [PATCH 048/169] Javadoc
---
src/main/java/org/apache/commons/dbcp2/Utils.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/Utils.java b/src/main/java/org/apache/commons/dbcp2/Utils.java
index 8652cae12e..d5c75f8b86 100644
--- a/src/main/java/org/apache/commons/dbcp2/Utils.java
+++ b/src/main/java/org/apache/commons/dbcp2/Utils.java
@@ -179,7 +179,7 @@ public static void closeQuietly(final Statement statement) {
*
JZ0C0 (Sybase disconnect error)
*
JZ0C1 (Sybase disconnect error)
*
- * @return SQL codes of fatal connection errors.
+ * @return A copy SQL codes of fatal connection errors.
* @since 2.10.0
*/
public static Set getDisconnectionSqlCodes() {
From df422388651f61f91828737c5b1b901cccb6fd80 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Wed, 7 Aug 2024 14:54:49 -0400
Subject: [PATCH 049/169] Bump org.apache.commons:commons-lang3 from 3.15.0 to
3.16.0 (#412)
Bumps org.apache.commons:commons-lang3 from 3.15.0 to 3.16.0.
---
updated-dependencies:
- dependency-name: org.apache.commons:commons-lang3
dependency-type: direct:development
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 999290c92f..3d9cb07bc0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -82,7 +82,7 @@
org.apache.commonscommons-lang3
- 3.15.0
+ 3.16.0test
From b8f3139c258f517adc97da32653273bee2a05087 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Wed, 7 Aug 2024 14:55:17 -0400
Subject: [PATCH 050/169] Bump org.apache.commons:commons-lang3 from 3.15.0 to
3.16.0 #412
---
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 12ce5041f5..d5a5335f3b 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -75,7 +75,7 @@ The type attribute can be add,update,fix,remove.
Bump org.apache.commons:commons-parent from 66 to 72 #360, #371, #395.Bump commons-logging:commons-logging from 1.3.0 to 1.3.3 #368, #399.
- Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.15.0 #404.
+ Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.16.0 #404, #412.Bump org.hamcrest:hamcrest from 2.2 to 3.0 #410.
From 86acffa6ccb93a63acaac06c21757880c8a62e08 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 9 Aug 2024 05:48:52 -0400
Subject: [PATCH 051/169] Bump actions/setup-java from 4.2.1 to 4.2.2 (#414)
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 4.2.1 to 4.2.2.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](https://github.com/actions/setup-java/compare/99b8673ff64fbf99d8d325f52d9a5bdedb8483e9...6a0805fcefea3d4657a47ac4c165951e33482018)
---
updated-dependencies:
- dependency-name: actions/setup-java
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/maven.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index b2cf2b9d7b..822b7994d4 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -46,7 +46,7 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK ${{ matrix.java }}
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
+ uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
From e44d82ca950176b676bb1ba27bc36506b82cc328 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 9 Aug 2024 05:49:11 -0400
Subject: [PATCH 052/169] Bump github/codeql-action from 3.25.15 to 3.26.0
(#416)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.25.15 to 3.26.0.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/afb54ba388a7dca6ecae48f608c4ff05ff4cc77a...eb055d739abdc2e8de2e5f4ba1a8b246daa779aa)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/codeql-analysis.yml | 6 +++---
.github/workflows/scorecards-analysis.yml | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index bc8bcc758b..281af97917 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -57,7 +57,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
- uses: github/codeql-action/init@afb54ba388a7dca6ecae48f608c4ff05ff4cc77a # 3.25.15
+ uses: github/codeql-action/init@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # 3.26.0
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -68,7 +68,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
- uses: github/codeql-action/autobuild@afb54ba388a7dca6ecae48f608c4ff05ff4cc77a # 3.25.15
+ uses: github/codeql-action/autobuild@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # 3.26.0
# âšī¸ Command-line programs to run using the OS shell.
# đ https://git.io/JvXDl
@@ -82,4 +82,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@afb54ba388a7dca6ecae48f608c4ff05ff4cc77a # 3.25.15
+ uses: github/codeql-action/analyze@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # 3.26.0
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index b7e502326d..2be81a0223 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -64,6 +64,6 @@ jobs:
retention-days: 5
- name: "Upload to code-scanning"
- uses: github/codeql-action/upload-sarif@afb54ba388a7dca6ecae48f608c4ff05ff4cc77a # 3.25.15
+ uses: github/codeql-action/upload-sarif@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # 3.26.0
with:
sarif_file: results.sarif
From 1f044b0dfb7f593dc7ed7c60acdddf0e0a73a7be Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 9 Aug 2024 05:49:23 -0400
Subject: [PATCH 053/169] Bump actions/upload-artifact from 4.3.4 to 4.3.6
(#415)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.3.4 to 4.3.6.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/0b2256b8c012f0828dc542b3febcab082c67f72b...834a144ee995460fba8ed112a2fc961b36a5ec5a)
---
updated-dependencies:
- dependency-name: actions/upload-artifact
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/scorecards-analysis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index 2be81a0223..bb13f9c0ad 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -57,7 +57,7 @@ jobs:
publish_results: true
- name: "Upload artifact"
- uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # 4.3.4
+ uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # 4.3.6
with:
name: SARIF file
path: results.sarif
From 69b5d9ddf7566e2f680834d868955ff574ef471a Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 9 Aug 2024 08:01:46 -0400
Subject: [PATCH 054/169] Bump org.slf4j:slf4j-simple from 2.0.13 to 2.0.15
(#413)
Bumps org.slf4j:slf4j-simple from 2.0.13 to 2.0.15.
---
updated-dependencies:
- dependency-name: org.slf4j:slf4j-simple
dependency-type: direct:development
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 3d9cb07bc0..7567c91e24 100644
--- a/pom.xml
+++ b/pom.xml
@@ -128,7 +128,7 @@
org.slf4jslf4j-simple
- 2.0.13
+ 2.0.15test
From 0752fd0e51db0739d56e9cbd198907ac83fe9589 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 9 Aug 2024 08:02:18 -0400
Subject: [PATCH 055/169] Bump org.slf4j:slf4j-simple from 2.0.13 to 2.0.15
#413
---
src/changes/changes.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index d5a5335f3b..aac51ae1a3 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -77,6 +77,7 @@ The type attribute can be add,update,fix,remove.
Bump commons-logging:commons-logging from 1.3.0 to 1.3.3 #368, #399.Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.16.0 #404, #412.Bump org.hamcrest:hamcrest from 2.2 to 3.0 #410.
+ Bump org.slf4j:slf4j-simple from 2.0.13 to 2.0.15 #413.
From 651c9255db72b0f84aaa75c13287dc3ca3e3fcad Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 12 Aug 2024 07:35:37 -0400
Subject: [PATCH 056/169] Javadoc
---
.../java/org/apache/commons/dbcp2/BasicDataSource.java | 10 +++++-----
.../org/apache/commons/dbcp2/PoolableConnection.java | 4 ++--
.../commons/dbcp2/PoolableConnectionFactory.java | 8 ++++----
src/main/java/org/apache/commons/dbcp2/Utils.java | 4 +++-
.../dbcp2/managed/PoolableManagedConnection.java | 2 +-
5 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java b/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
index 45511a3fa5..95b756bf78 100644
--- a/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
@@ -853,7 +853,7 @@ public int getDefaultTransactionIsolation() {
}
/**
- * Gets the set of SQL_STATE codes considered to signal fatal conditions.
+ * Gets the set of SQL State codes considered to signal fatal conditions.
*
* @return fatal disconnection state codes
* @see #setDisconnectionSqlCodes(Collection)
@@ -950,7 +950,7 @@ public synchronized String getEvictionPolicyClassName() {
/**
* True means that validation will fail immediately for connections that have previously thrown SQLExceptions with
- * SQL_STATE indicating fatal disconnection errors.
+ * SQL State indicating fatal disconnection errors.
*
* @return true if connections created by this datasource will fast fail validation.
* @see #setDisconnectionSqlCodes(Collection)
@@ -1945,11 +1945,11 @@ public void setDefaultTransactionIsolation(final int defaultTransactionIsolation
}
/**
- * Sets the SQL_STATE codes considered to signal fatal conditions.
+ * Sets the SQL State codes considered to signal fatal conditions.
*
* Overrides the defaults in {@link Utils#getDisconnectionSqlCodes()} (plus anything starting with
* {@link Utils#DISCONNECTION_SQL_CODE_PREFIX}). If this property is non-null and {@link #getFastFailValidation()}
- * is {@code true}, whenever connections created by this datasource generate exceptions with SQL_STATE codes in this
+ * is {@code true}, whenever connections created by this datasource generate exceptions with SQL State codes in this
* list, they will be marked as "fatally disconnected" and subsequent validations will fail fast (no attempt at
* isValid or validation query).
*
@@ -1962,7 +1962,7 @@ public void setDefaultTransactionIsolation(final int defaultTransactionIsolation
* setLoginTimeout, getLoginTimeout, getLogWriter}.
*
*
- * @param disconnectionSqlCodes SQL_STATE codes considered to signal fatal conditions
+ * @param disconnectionSqlCodes SQL State codes considered to signal fatal conditions
* @since 2.1
*/
public void setDisconnectionSqlCodes(final Collection disconnectionSqlCodes) {
diff --git a/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java b/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java
index c99e789a55..1497e9e61e 100644
--- a/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java
+++ b/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java
@@ -71,7 +71,7 @@ public class PoolableConnection extends DelegatingConnection impleme
private boolean fatalSqlExceptionThrown;
/**
- * SQL_STATE codes considered to signal fatal conditions. Overrides the defaults in
+ * SQL State codes considered to signal fatal conditions. Overrides the defaults in
* {@link Utils#getDisconnectionSqlCodes()} (plus anything starting with {@link Utils#DISCONNECTION_SQL_CODE_PREFIX}).
*/
private final Collection disconnectionSqlCodes;
@@ -104,7 +104,7 @@ public PoolableConnection(final Connection conn, final ObjectPool
* Overrides the defaults in {@link Utils#getDisconnectionSqlCodes()} (plus anything starting with
* {@link Utils#DISCONNECTION_SQL_CODE_PREFIX}). If this property is non-null and {@link #isFastFailValidation()} is
- * {@code true}, whenever connections created by this factory generate exceptions with SQL_STATE codes in this list,
+ * {@code true}, whenever connections created by this factory generate exceptions with SQL State codes in this list,
* they will be marked as "fatally disconnected" and subsequent validations will fail fast (no attempt at isValid or
* validation query).
*
@@ -283,7 +283,7 @@ public int getDefaultTransactionIsolation() {
* If {@link #isFastFailValidation()} is {@code false} setting this property has no effect.
*
*
- * @return SQL_STATE codes overriding defaults
+ * @return SQL State codes overriding defaults
* @since 2.1
*/
public Collection getDisconnectionSqlCodes() {
@@ -391,7 +391,7 @@ public boolean isEnableAutoCommitOnReturn() {
/**
* True means that validation will fail immediately for connections that have previously thrown SQLExceptions with
- * SQL_STATE indicating fatal disconnection errors.
+ * SQL State indicating fatal disconnection errors.
*
* @return true if connections created by this factory will fast fail validation.
* @see #setDisconnectionSqlCodes(Collection)
diff --git a/src/main/java/org/apache/commons/dbcp2/Utils.java b/src/main/java/org/apache/commons/dbcp2/Utils.java
index d5c75f8b86..fd106d89a3 100644
--- a/src/main/java/org/apache/commons/dbcp2/Utils.java
+++ b/src/main/java/org/apache/commons/dbcp2/Utils.java
@@ -49,7 +49,9 @@ public final class Utils {
@Deprecated
public static final boolean IS_SECURITY_ENABLED = isSecurityEnabled();
- /** Any SQL_STATE starting with this value is considered a fatal disconnect */
+ /**
+ * Any SQL State starting with this value is considered a fatal disconnect.
+ */
public static final String DISCONNECTION_SQL_CODE_PREFIX = "08";
/**
diff --git a/src/main/java/org/apache/commons/dbcp2/managed/PoolableManagedConnection.java b/src/main/java/org/apache/commons/dbcp2/managed/PoolableManagedConnection.java
index 858a0c4401..29d0585b7b 100644
--- a/src/main/java/org/apache/commons/dbcp2/managed/PoolableManagedConnection.java
+++ b/src/main/java/org/apache/commons/dbcp2/managed/PoolableManagedConnection.java
@@ -57,7 +57,7 @@ public PoolableManagedConnection(final TransactionRegistry transactionRegistry,
* @param pool
* connection pool
* @param disconnectSqlCodes
- * SQL_STATE codes considered fatal disconnection errors
+ * SQL State codes considered fatal disconnection errors
* @param fastFailValidation
* true means fatal disconnection errors cause subsequent validations to fail immediately (no attempt to
* run query or isValid)
From 8768edab5fb6f3d9be1c59d48e318da3c4eea92f Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 16 Aug 2024 05:27:19 -0400
Subject: [PATCH 057/169] Bump github/codeql-action from 3.26.0 to 3.26.2
(#417)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.26.0 to 3.26.2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/eb055d739abdc2e8de2e5f4ba1a8b246daa779aa...429e1977040da7a23b6822b13c129cd1ba93dbb2)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/codeql-analysis.yml | 6 +++---
.github/workflows/scorecards-analysis.yml | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 281af97917..e5d7315bb9 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -57,7 +57,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
- uses: github/codeql-action/init@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # 3.26.0
+ uses: github/codeql-action/init@429e1977040da7a23b6822b13c129cd1ba93dbb2 # 3.26.2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -68,7 +68,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
- uses: github/codeql-action/autobuild@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # 3.26.0
+ uses: github/codeql-action/autobuild@429e1977040da7a23b6822b13c129cd1ba93dbb2 # 3.26.2
# âšī¸ Command-line programs to run using the OS shell.
# đ https://git.io/JvXDl
@@ -82,4 +82,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # 3.26.0
+ uses: github/codeql-action/analyze@429e1977040da7a23b6822b13c129cd1ba93dbb2 # 3.26.2
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index bb13f9c0ad..5ddf1e85aa 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -64,6 +64,6 @@ jobs:
retention-days: 5
- name: "Upload to code-scanning"
- uses: github/codeql-action/upload-sarif@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # 3.26.0
+ uses: github/codeql-action/upload-sarif@429e1977040da7a23b6822b13c129cd1ba93dbb2 # 3.26.2
with:
sarif_file: results.sarif
From 536d9560a25afc2133ed790f93026cc79a741fd1 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 16 Aug 2024 08:23:31 -0400
Subject: [PATCH 058/169] Bump org.slf4j:slf4j-simple from 2.0.15 to 2.0.16
(#418)
Bumps org.slf4j:slf4j-simple from 2.0.15 to 2.0.16.
---
updated-dependencies:
- dependency-name: org.slf4j:slf4j-simple
dependency-type: direct:development
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 7567c91e24..d78c75f97c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -128,7 +128,7 @@
org.slf4jslf4j-simple
- 2.0.15
+ 2.0.16test
From 49c846f1c8fbe8fbc085d12b3462edfb1ce32c52 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 16 Aug 2024 08:24:02 -0400
Subject: [PATCH 059/169] Bump org.slf4j:slf4j-simple from 2.0.15 to 2.0.16
#418
---
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index aac51ae1a3..029e85ffe4 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -77,7 +77,7 @@ The type attribute can be add,update,fix,remove.
Bump commons-logging:commons-logging from 1.3.0 to 1.3.3 #368, #399.Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.16.0 #404, #412.Bump org.hamcrest:hamcrest from 2.2 to 3.0 #410.
- Bump org.slf4j:slf4j-simple from 2.0.13 to 2.0.15 #413.
+ Bump org.slf4j:slf4j-simple from 2.0.13 to 2.0.16 #413, #418.
From adfcfbcee8e7084cbe4ddf2b745d3e6a3feb2a32 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Sun, 18 Aug 2024 10:57:22 -0400
Subject: [PATCH 060/169] Bump org.apache.commons:commons-parent from 72 to 73
(#420)
Bumps [org.apache.commons:commons-parent](https://github.com/apache/commons-parent) from 72 to 73.
- [Changelog](https://github.com/apache/commons-parent/blob/master/RELEASE-NOTES.txt)
- [Commits](https://github.com/apache/commons-parent/commits)
---
updated-dependencies:
- dependency-name: org.apache.commons:commons-parent
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index d78c75f97c..29efb76891 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
org.apache.commonscommons-parent
- 72
+ 734.0.0commons-dbcp2
From 04dcb7d601d13669366b952c085674708da3e764 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sun, 18 Aug 2024 10:57:51 -0400
Subject: [PATCH 061/169] Bump org.apache.commons:commons-parent from 72 to 73
(#420)
---
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 029e85ffe4..435e012a01 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -73,7 +73,7 @@ The type attribute can be add,update,fix,remove.
Fix SpotBugs MC_OVERRIDABLE_METHOD_CALL_IN_READ_OBJECT in SharedPoolDataSource.
- Bump org.apache.commons:commons-parent from 66 to 72 #360, #371, #395.
+ Bump org.apache.commons:commons-parent from 66 to 73 #360, #371, #395, #420.Bump commons-logging:commons-logging from 1.3.0 to 1.3.3 #368, #399.Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.16.0 #404, #412.Bump org.hamcrest:hamcrest from 2.2 to 3.0 #410.
From 0b4c934d3a5ac63e748e4daca7927bf08063136d Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 19 Aug 2024 10:45:58 -0400
Subject: [PATCH 062/169] Bump commons-logging:commons-logging from 1.3.3 to
1.3.4 (#423)
Bumps commons-logging:commons-logging from 1.3.3 to 1.3.4.
---
updated-dependencies:
- dependency-name: commons-logging:commons-logging
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 29efb76891..ac095d0a83 100644
--- a/pom.xml
+++ b/pom.xml
@@ -63,7 +63,7 @@
commons-loggingcommons-logging
- 1.3.3
+ 1.3.4
From 2c13212c6a3a2859a92f929d322630eb4e796292 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 19 Aug 2024 10:46:37 -0400
Subject: [PATCH 063/169] Bump commons-logging:commons-logging from 1.3.3 to
1.3.4 #423
---
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 435e012a01..e3341bcafe 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -74,7 +74,7 @@ The type attribute can be add,update,fix,remove.
Bump org.apache.commons:commons-parent from 66 to 73 #360, #371, #395, #420.
- Bump commons-logging:commons-logging from 1.3.0 to 1.3.3 #368, #399.
+ Bump commons-logging:commons-logging from 1.3.0 to 1.3.4 #368, #399, #423.Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.16.0 #404, #412.Bump org.hamcrest:hamcrest from 2.2 to 3.0 #410.Bump org.slf4j:slf4j-simple from 2.0.13 to 2.0.16 #413, #418.
From 25aa107a8fd349173dc3ce8727e33215fba29e5c Mon Sep 17 00:00:00 2001
From: Johno Crawford
Date: Mon, 19 Aug 2024 18:17:03 +0200
Subject: [PATCH 064/169] Add support for ignoring non-fatal SQL state codes.
(#421)
* Add support for ignoring non-fatal SQL state codes.
* Correct since tags.
Fix javadocs.
Add disconnectionIgnoreSqlCodes to xdoc.
Throw illegal argument exception if sql state code configurations overlap.
* More tests.
* Check style fixes.
---
.../apache/commons/dbcp2/BasicDataSource.java | 70 +++++++++++++++++++
.../commons/dbcp2/BasicDataSourceFactory.java | 17 ++++-
.../commons/dbcp2/DataSourceMXBean.java | 10 +++
.../commons/dbcp2/PoolableConnection.java | 40 ++++++++++-
.../dbcp2/PoolableConnectionFactory.java | 38 +++++++++-
.../java/org/apache/commons/dbcp2/Utils.java | 23 ++++++
.../dbcp2/managed/BasicManagedDataSource.java | 1 +
.../managed/PoolableManagedConnection.java | 26 ++++++-
.../PoolableManagedConnectionFactory.java | 2 +-
src/site/xdoc/configuration.xml | 8 +++
.../commons/dbcp2/TestBasicDataSource.java | 46 ++++++++++++
.../dbcp2/TestBasicDataSourceMXBean.java | 5 ++
.../commons/dbcp2/TestPoolableConnection.java | 22 ++++++
.../org/apache/commons/dbcp2/TestUtils.java | 58 +++++++++++++++
14 files changed, 359 insertions(+), 7 deletions(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java b/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
index 95b756bf78..b7e3fe5113 100644
--- a/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.dbcp2;
+import static org.apache.commons.dbcp2.Utils.checkForConflicts;
+
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
@@ -346,6 +348,12 @@ protected static void validateConnectionFactory(final PoolableConnectionFactory
private volatile Set disconnectionSqlCodes;
+ /**
+ * A collection of SQL State codes that are not considered fatal disconnection codes.
+ * @since 2.13.0
+ */
+ private volatile Set disconnectionIgnoreSqlCodes;
+
private boolean fastFailValidation;
/**
@@ -629,6 +637,7 @@ protected PoolableConnectionFactory createPoolableConnectionFactory(final Connec
connectionFactory.setDefaultQueryTimeout(getDefaultQueryTimeoutDuration());
connectionFactory.setFastFailValidation(fastFailValidation);
connectionFactory.setDisconnectionSqlCodes(disconnectionSqlCodes);
+ connectionFactory.setDisconnectionIgnoreSqlCodes(disconnectionIgnoreSqlCodes);
validateConnectionFactory(connectionFactory);
} catch (final RuntimeException e) {
throw e;
@@ -864,6 +873,22 @@ public Set getDisconnectionSqlCodes() {
return result == null ? Collections.emptySet() : result;
}
+ /**
+ * Gets the set of SQL State codes that are not considered fatal disconnection codes.
+ *
+ * This method returns the set of SQL State codes that have been specified to be ignored
+ * when determining if a {@link SQLException} signals a disconnection. These codes will not
+ * trigger a disconnection even if they match other disconnection criteria.
+ *
+ *
+ * @return a set of SQL State codes that should be ignored for disconnection checks, or an empty set if none have been specified.
+ * @since 2.13.0
+ */
+ public Set getDisconnectionIgnoreSqlCodes() {
+ final Set result = disconnectionIgnoreSqlCodes;
+ return result == null ? Collections.emptySet() : result;
+ }
+
/**
* Provides the same data as {@link #getDisconnectionSqlCodes} but in an array so it is accessible via JMX.
*
@@ -874,6 +899,16 @@ public String[] getDisconnectionSqlCodesAsArray() {
return getDisconnectionSqlCodes().toArray(Utils.EMPTY_STRING_ARRAY);
}
+ /**
+ * Provides the same data as {@link #getDisconnectionIgnoreSqlCodes()} but in an array, so it is accessible via JMX.
+ *
+ * @since 2.13.0
+ */
+ @Override
+ public String[] getDisconnectionIgnoreSqlCodesAsArray() {
+ return getDisconnectionIgnoreSqlCodes().toArray(Utils.EMPTY_STRING_ARRAY);
+ }
+
/**
* Gets the JDBC Driver that has been configured for use by this pool.
*
@@ -954,6 +989,7 @@ public synchronized String getEvictionPolicyClassName() {
*
* @return true if connections created by this datasource will fast fail validation.
* @see #setDisconnectionSqlCodes(Collection)
+ * @see #setDisconnectionIgnoreSqlCodes(Collection)
* @since 2.1
*/
@Override
@@ -1964,13 +2000,47 @@ public void setDefaultTransactionIsolation(final int defaultTransactionIsolation
*
* @param disconnectionSqlCodes SQL State codes considered to signal fatal conditions
* @since 2.1
+ * @throws IllegalArgumentException if any SQL state codes overlap with those in {@link #disconnectionIgnoreSqlCodes}.
*/
public void setDisconnectionSqlCodes(final Collection disconnectionSqlCodes) {
+ checkForConflicts(disconnectionSqlCodes, this.disconnectionIgnoreSqlCodes,
+ "disconnectionSqlCodes", "disconnectionIgnoreSqlCodes");
final Set collect = Utils.isEmpty(disconnectionSqlCodes) ? null
: disconnectionSqlCodes.stream().filter(s -> !isEmpty(s)).collect(Collectors.toSet());
this.disconnectionSqlCodes = Utils.isEmpty(collect) ? null : collect;
}
+ /**
+ * Sets the SQL State codes that should be ignored when determining fatal disconnection conditions.
+ *
+ * This method allows you to specify a collection of SQL State codes that will be excluded from
+ * disconnection checks. These codes will not trigger the "fatally disconnected" status even if they
+ * match the typical disconnection criteria. This can be useful in scenarios where certain SQL State
+ * codes (e.g., specific codes starting with "08") are known to be non-fatal in your environment.
+ *
+ *
+ * The effect of this method is similar to the one described in {@link #setDisconnectionSqlCodes(Collection)},
+ * but instead of setting codes that signal fatal disconnections, it defines codes that should be ignored
+ * during such checks.
+ *
+ *
+ * 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}.
+ *
+ *
+ * @param disconnectionIgnoreSqlCodes SQL State codes that should be ignored in disconnection checks
+ * @since 2.13.0
+ * @throws IllegalArgumentException if any SQL state codes overlap with those in {@link #disconnectionSqlCodes}.
+ */
+ public void setDisconnectionIgnoreSqlCodes(final Collection disconnectionIgnoreSqlCodes) {
+ checkForConflicts(disconnectionIgnoreSqlCodes, this.disconnectionSqlCodes,
+ "disconnectionIgnoreSqlCodes", "disconnectionSqlCodes");
+ final Set collect = Utils.isEmpty(disconnectionIgnoreSqlCodes) ? null
+ : disconnectionIgnoreSqlCodes.stream().filter(s -> !isEmpty(s)).collect(Collectors.toSet());
+ this.disconnectionIgnoreSqlCodes = Utils.isEmpty(collect) ? null : collect;
+ }
+
/**
* Sets the JDBC Driver instance to use for this pool.
*
diff --git a/src/main/java/org/apache/commons/dbcp2/BasicDataSourceFactory.java b/src/main/java/org/apache/commons/dbcp2/BasicDataSourceFactory.java
index a28b21bf52..84beb588dd 100644
--- a/src/main/java/org/apache/commons/dbcp2/BasicDataSourceFactory.java
+++ b/src/main/java/org/apache/commons/dbcp2/BasicDataSourceFactory.java
@@ -120,6 +120,18 @@ public class BasicDataSourceFactory implements ObjectFactory {
*/
private static final String PROP_DISCONNECTION_SQL_CODES = "disconnectionSqlCodes";
+ /**
+ * Property key for specifying the SQL State codes that should be ignored during disconnection checks.
+ *
+ * The value for this property must be a comma-separated string of SQL State codes, where each code represents
+ * a state that will be excluded from being treated as a fatal disconnection. The expected format is a series
+ * of SQL State codes separated by commas, with no spaces between them (e.g., "08003,08004").
+ *
+ * @since 2.13.0
+ */
+ private static final String PROP_DISCONNECTION_IGNORE_SQL_CODES = "disconnectionIgnoreSqlCodes";
+
+
/*
* Block with obsolete properties from DBCP 1.x. Warn users that these are ignored and they should use the 2.x
* properties.
@@ -149,8 +161,8 @@ public class BasicDataSourceFactory implements ObjectFactory {
PROP_CLEAR_STATEMENT_POOL_ON_RETURN,
PROP_MAX_OPEN_PREPARED_STATEMENTS, PROP_CONNECTION_PROPERTIES, PROP_MAX_CONN_LIFETIME_MILLIS,
PROP_LOG_EXPIRED_CONNECTIONS, PROP_ROLLBACK_ON_RETURN, PROP_ENABLE_AUTO_COMMIT_ON_RETURN,
- PROP_DEFAULT_QUERY_TIMEOUT, PROP_FAST_FAIL_VALIDATION, PROP_DISCONNECTION_SQL_CODES, PROP_JMX_NAME,
- PROP_REGISTER_CONNECTION_MBEAN, PROP_CONNECTION_FACTORY_CLASS_NAME);
+ PROP_DEFAULT_QUERY_TIMEOUT, PROP_FAST_FAIL_VALIDATION, PROP_DISCONNECTION_SQL_CODES, PROP_DISCONNECTION_IGNORE_SQL_CODES,
+ PROP_JMX_NAME, PROP_REGISTER_CONNECTION_MBEAN, PROP_CONNECTION_FACTORY_CLASS_NAME);
/**
* Obsolete properties from DBCP 1.x. with warning strings suggesting new properties. LinkedHashMap will guarantee
@@ -302,6 +314,7 @@ public static BasicDataSource createDataSource(final Properties properties) thro
acceptDurationOfSeconds(properties, PROP_DEFAULT_QUERY_TIMEOUT, dataSource::setDefaultQueryTimeout);
acceptBoolean(properties, PROP_FAST_FAIL_VALIDATION, dataSource::setFastFailValidation);
getOptional(properties, PROP_DISCONNECTION_SQL_CODES).ifPresent(v -> dataSource.setDisconnectionSqlCodes(parseList(v, ',')));
+ getOptional(properties, PROP_DISCONNECTION_IGNORE_SQL_CODES).ifPresent(v -> dataSource.setDisconnectionIgnoreSqlCodes(parseList(v, ',')));
acceptString(properties, PROP_CONNECTION_FACTORY_CLASS_NAME, dataSource::setConnectionFactoryClassName);
// DBCP-215
diff --git a/src/main/java/org/apache/commons/dbcp2/DataSourceMXBean.java b/src/main/java/org/apache/commons/dbcp2/DataSourceMXBean.java
index d3208c20f5..3c55187bc7 100644
--- a/src/main/java/org/apache/commons/dbcp2/DataSourceMXBean.java
+++ b/src/main/java/org/apache/commons/dbcp2/DataSourceMXBean.java
@@ -93,6 +93,16 @@ default String getDefaultSchema() {
*/
String[] getDisconnectionSqlCodesAsArray();
+ /**
+ * See {@link BasicDataSource#getDisconnectionIgnoreSqlCodesAsArray()}.
+ *
+ * @return {@link BasicDataSource#getDisconnectionIgnoreSqlCodesAsArray()}.
+ * @since 2.13.0
+ */
+ default String[] getDisconnectionIgnoreSqlCodesAsArray() {
+ return Utils.EMPTY_STRING_ARRAY;
+ }
+
/**
* See {@link BasicDataSource#getDriverClassName()}.
*
diff --git a/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java b/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java
index 1497e9e61e..2694022162 100644
--- a/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java
+++ b/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java
@@ -76,6 +76,13 @@ public class PoolableConnection extends DelegatingConnection impleme
*/
private final Collection disconnectionSqlCodes;
+ /**
+ * A collection of SQL State codes that are not considered fatal disconnection codes.
+ * @since 2.13.0
+ */
+ private final Collection disconnectionIgnoreSqlCodes;
+
+
/** Whether or not to fast fail validation after fatal connection errors */
private final boolean fastFailValidation;
@@ -109,13 +116,38 @@ public PoolableConnection(final Connection conn, final ObjectPool pool,
+ final ObjectName jmxObjectName, final Collection disconnectSqlCodes,
+ final boolean fastFailValidation) {
+ this(conn, pool, jmxObjectName, disconnectSqlCodes, null, fastFailValidation);
+ }
+
+ /**
+ * Creates a new {@link PoolableConnection} instance.
+ *
+ * @param conn
+ * my underlying connection
+ * @param pool
+ * the pool to which I should return when closed
+ * @param jmxObjectName
+ * JMX name
+ * @param disconnectSqlCodes
+ * SQL State codes considered fatal disconnection errors
+ * @param disconnectionIgnoreSqlCodes
+ * SQL State codes that should be ignored when determining fatal disconnection errors
+ * @param fastFailValidation
+ * true means fatal disconnection errors cause subsequent validations to fail immediately (no attempt to
+ * run query or isValid)
+ * @since 2.13.0
+ */
public PoolableConnection(final Connection conn, final ObjectPool pool,
final ObjectName jmxObjectName, final Collection disconnectSqlCodes,
- final boolean fastFailValidation) {
+ final Collection disconnectionIgnoreSqlCodes, final boolean fastFailValidation) {
super(conn);
this.pool = pool;
this.jmxObjectName = ObjectNameWrapper.wrap(jmxObjectName);
this.disconnectionSqlCodes = disconnectSqlCodes;
+ this.disconnectionIgnoreSqlCodes = disconnectionIgnoreSqlCodes;
this.fastFailValidation = fastFailValidation;
if (jmxObjectName != null) {
@@ -257,7 +289,8 @@ public boolean isClosed() throws SQLException {
* If {@link #disconnectionSqlCodes} has been set, sql states are compared to those in the configured list of fatal
* exception codes. If this property is not set, codes are compared against the default codes in
* {@link Utils#getDisconnectionSqlCodes()} and in this case anything starting with #{link
- * Utils.DISCONNECTION_SQL_CODE_PREFIX} is considered a disconnection.
+ * Utils.DISCONNECTION_SQL_CODE_PREFIX} is considered a disconnection. Additionally, any SQL state
+ * listed in {@link #disconnectionIgnoreSqlCodes} will be ignored and not treated as fatal.
*
*
* @param e SQLException to be examined
@@ -267,6 +300,9 @@ boolean isDisconnectionSqlException(final SQLException e) {
boolean fatalException = false;
final String sqlState = e.getSQLState();
if (sqlState != null) {
+ if (disconnectionIgnoreSqlCodes != null && disconnectionIgnoreSqlCodes.contains(sqlState)) {
+ return false;
+ }
fatalException = disconnectionSqlCodes == null
? sqlState.startsWith(Utils.DISCONNECTION_SQL_CODE_PREFIX) || Utils.getDisconnectionSqlCodes().contains(sqlState)
: disconnectionSqlCodes.contains(sqlState);
diff --git a/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java b/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java
index 8de3a6367e..ff6d05131f 100644
--- a/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java
+++ b/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.dbcp2;
+import static org.apache.commons.dbcp2.Utils.checkForConflicts;
+
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
@@ -64,6 +66,8 @@ public class PoolableConnectionFactory implements PooledObjectFactory disconnectionSqlCodes;
+ private Collection disconnectionIgnoreSqlCodes;
+
private boolean fastFailValidation = true;
private volatile ObjectPool pool;
@@ -290,6 +294,21 @@ public Collection getDisconnectionSqlCodes() {
return disconnectionSqlCodes;
}
+ /**
+ * Retrieves the collection of SQL State codes that are not considered fatal disconnection codes.
+ *
+ * This method returns the collection of SQL State codes that have been set to be ignored when
+ * determining if a {@link SQLException} signals a disconnection. These codes are excluded from
+ * being treated as fatal even if they match the typical disconnection criteria.
+ *
+ *
+ * @return a {@link Collection} of SQL State codes that should be ignored for disconnection checks.
+ * @since 2.13.0
+ */
+ public Collection getDisconnectionIgnoreSqlCodes() {
+ return disconnectionIgnoreSqlCodes;
+ }
+
/**
* Gets the Maximum connection duration.
*
@@ -464,7 +483,8 @@ public PooledObject makeObject() throws SQLException {
}
}
- final PoolableConnection pc = new PoolableConnection(conn, pool, connJmxName, disconnectionSqlCodes, fastFailValidation);
+ final PoolableConnection pc = new PoolableConnection(conn, pool, connJmxName,
+ disconnectionSqlCodes, disconnectionIgnoreSqlCodes, fastFailValidation);
pc.setCacheState(cacheState);
return new DefaultPooledObject<>(pc);
@@ -606,11 +626,27 @@ public void setDefaultTransactionIsolation(final int defaultTransactionIsolation
* The disconnection SQL codes.
* @see #getDisconnectionSqlCodes()
* @since 2.1
+ * @throws IllegalArgumentException if any SQL state codes overlap with those in {@link #disconnectionIgnoreSqlCodes}.
*/
public void setDisconnectionSqlCodes(final Collection disconnectionSqlCodes) {
+ checkForConflicts(disconnectionSqlCodes, this.disconnectionIgnoreSqlCodes,
+ "disconnectionSqlCodes", "disconnectionIgnoreSqlCodes");
this.disconnectionSqlCodes = disconnectionSqlCodes;
}
+ /**
+ * @param disconnectionIgnoreSqlCodes
+ * The collection of SQL State codes to be ignored.
+ * @see #getDisconnectionIgnoreSqlCodes()
+ * @since 2.13.0
+ * @throws IllegalArgumentException if any SQL state codes overlap with those in {@link #disconnectionSqlCodes}.
+ */
+ public void setDisconnectionIgnoreSqlCodes(Collection disconnectionIgnoreSqlCodes) {
+ checkForConflicts(disconnectionIgnoreSqlCodes, this.disconnectionSqlCodes,
+ "disconnectionIgnoreSqlCodes", "disconnectionSqlCodes");
+ this.disconnectionIgnoreSqlCodes = disconnectionIgnoreSqlCodes;
+ }
+
/**
* @param autoCommitOnReturn Whether to auto-commit on return.
* @deprecated Use {@link #setAutoCommitOnReturn(boolean)}.
diff --git a/src/main/java/org/apache/commons/dbcp2/Utils.java b/src/main/java/org/apache/commons/dbcp2/Utils.java
index fd106d89a3..ad927225c6 100644
--- a/src/main/java/org/apache/commons/dbcp2/Utils.java
+++ b/src/main/java/org/apache/commons/dbcp2/Utils.java
@@ -138,6 +138,29 @@ public static void closeQuietly(final AutoCloseable autoCloseable) {
close(autoCloseable, null);
}
+ /**
+ * Checks for conflicts between two collections.
+ *
+ * If any overlap is found between the two provided collections, an {@link IllegalArgumentException} is thrown.
+ *
+ *
+ * @param codes1 The first collection of SQL state codes.
+ * @param codes2 The second collection of SQL state codes.
+ * @param name1 The name of the first collection (for exception message).
+ * @param name2 The name of the second collection (for exception message).
+ * @since 2.13.0
+ * @throws IllegalArgumentException if any codes overlap between the two collections.
+ */
+ static void checkForConflicts(Collection codes1, Collection codes2, String name1, String name2) {
+ if (codes1 != null && codes2 != null) {
+ for (String code : codes1) {
+ if (codes2.contains(code)) {
+ throw new IllegalArgumentException(code + " cannot be in both " + name1 + " and " + name2 + ".");
+ }
+ }
+ }
+ }
+
/**
* Closes the Connection (which may be null).
*
diff --git a/src/main/java/org/apache/commons/dbcp2/managed/BasicManagedDataSource.java b/src/main/java/org/apache/commons/dbcp2/managed/BasicManagedDataSource.java
index 719ee4d09c..c293e27cd2 100644
--- a/src/main/java/org/apache/commons/dbcp2/managed/BasicManagedDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/managed/BasicManagedDataSource.java
@@ -146,6 +146,7 @@ protected PoolableConnectionFactory createPoolableConnectionFactory(final Connec
connectionFactory.setDefaultQueryTimeout(getDefaultQueryTimeoutDuration());
connectionFactory.setFastFailValidation(getFastFailValidation());
connectionFactory.setDisconnectionSqlCodes(getDisconnectionSqlCodes());
+ connectionFactory.setDisconnectionIgnoreSqlCodes(getDisconnectionIgnoreSqlCodes());
validateConnectionFactory(connectionFactory);
} catch (final RuntimeException e) {
throw e;
diff --git a/src/main/java/org/apache/commons/dbcp2/managed/PoolableManagedConnection.java b/src/main/java/org/apache/commons/dbcp2/managed/PoolableManagedConnection.java
index 29d0585b7b..5eea0397de 100644
--- a/src/main/java/org/apache/commons/dbcp2/managed/PoolableManagedConnection.java
+++ b/src/main/java/org/apache/commons/dbcp2/managed/PoolableManagedConnection.java
@@ -65,7 +65,31 @@ public PoolableManagedConnection(final TransactionRegistry transactionRegistry,
public PoolableManagedConnection(final TransactionRegistry transactionRegistry, final Connection conn,
final ObjectPool pool, final Collection disconnectSqlCodes,
final boolean fastFailValidation) {
- super(conn, pool, null, disconnectSqlCodes, fastFailValidation);
+ this(transactionRegistry, conn, pool, disconnectSqlCodes, null, fastFailValidation);
+ }
+
+ /**
+ * Create a PoolableManagedConnection.
+ *
+ * @param transactionRegistry
+ * transaction registry
+ * @param conn
+ * underlying connection
+ * @param pool
+ * connection pool
+ * @param disconnectSqlCodes
+ * SQL State codes considered fatal disconnection errors
+ * @param disconnectionIgnoreSqlCodes
+ * SQL State codes considered fatal disconnection errors
+ * @param fastFailValidation
+ * true means fatal disconnection errors cause subsequent validations to fail immediately (no attempt to
+ * run query or isValid)
+ * @since 2.13.0
+ */
+ public PoolableManagedConnection(final TransactionRegistry transactionRegistry, final Connection conn,
+ final ObjectPool pool, final Collection disconnectSqlCodes,
+ final Collection disconnectionIgnoreSqlCodes, final boolean fastFailValidation) {
+ super(conn, pool, null, disconnectSqlCodes, disconnectionIgnoreSqlCodes, fastFailValidation);
this.transactionRegistry = transactionRegistry;
}
diff --git a/src/main/java/org/apache/commons/dbcp2/managed/PoolableManagedConnectionFactory.java b/src/main/java/org/apache/commons/dbcp2/managed/PoolableManagedConnectionFactory.java
index 7eb810154d..92db944f65 100644
--- a/src/main/java/org/apache/commons/dbcp2/managed/PoolableManagedConnectionFactory.java
+++ b/src/main/java/org/apache/commons/dbcp2/managed/PoolableManagedConnectionFactory.java
@@ -104,7 +104,7 @@ public synchronized PooledObject makeObject() throws SQLExce
((PoolingConnection) conn).setCacheState(getCacheState());
}
final PoolableManagedConnection pmc = new PoolableManagedConnection(transactionRegistry, conn, getPool(),
- getDisconnectionSqlCodes(), isFastFailValidation());
+ getDisconnectionSqlCodes(), getDisconnectionIgnoreSqlCodes(), isFastFailValidation());
pmc.setCacheState(getCacheState());
return new DefaultPooledObject<>(pmc);
}
diff --git a/src/site/xdoc/configuration.xml b/src/site/xdoc/configuration.xml
index 9579736544..9f6ce90011 100644
--- a/src/site/xdoc/configuration.xml
+++ b/src/site/xdoc/configuration.xml
@@ -498,6 +498,14 @@ the parent connection.
fastFailValidation is set to true.
+
+
disconnectionIgnoreSqlCodes
+
null
+
Comma-delimited list of SQL State codes that should be ignored when determining fatal disconnection errors.
+ These codes will not trigger a fatal disconnection status, even if they match the usual criteria.
+ Setting this property has no effect unless fastFailValidation is set to true.
+
+
jmxName
diff --git a/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java b/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java
index 47a6d58062..3b3ec7ed50 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java
@@ -36,6 +36,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.HashSet;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
@@ -459,6 +460,51 @@ public void testDisconnectSqlCodes() throws Exception {
}
}
+ @Test
+ public void testOverlapBetweenDisconnectionAndIgnoreSqlCodes() {
+ // Set initial disconnection SQL codes
+ final HashSet disconnectionSqlCodes = new HashSet<>(Arrays.asList("XXX", "ZZZ"));
+ ds.setDisconnectionSqlCodes(disconnectionSqlCodes);
+
+ // Try setting ignore SQL codes with overlap
+ final HashSet disconnectionIgnoreSqlCodes = new HashSet<>(Arrays.asList("YYY", "XXX"));
+
+ IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> {
+ ds.setDisconnectionIgnoreSqlCodes(disconnectionIgnoreSqlCodes);
+ });
+
+ assertEquals("XXX cannot be in both disconnectionIgnoreSqlCodes and disconnectionSqlCodes.", exception.getMessage());
+ }
+
+ @Test
+ public void testNoOverlapBetweenDisconnectionAndIgnoreSqlCodes() {
+ // Set disconnection SQL codes without overlap
+ final HashSet disconnectionSqlCodes = new HashSet<>(Arrays.asList("XXX", "ZZZ"));
+ ds.setDisconnectionSqlCodes(disconnectionSqlCodes);
+
+ // Set ignore SQL codes without overlap
+ final HashSet disconnectionIgnoreSqlCodes = new HashSet<>(Arrays.asList("YYY", "AAA"));
+ ds.setDisconnectionIgnoreSqlCodes(disconnectionIgnoreSqlCodes);
+
+ assertEquals(disconnectionSqlCodes, ds.getDisconnectionSqlCodes(), "Disconnection SQL codes should match the set values.");
+ assertEquals(disconnectionIgnoreSqlCodes, ds.getDisconnectionIgnoreSqlCodes(), "Disconnection Ignore SQL codes should match the set values.");
+ }
+
+ @Test
+ public void testDisconnectionIgnoreSqlCodes() throws Exception {
+ final ArrayList disconnectionIgnoreSqlCodes = new ArrayList<>();
+ disconnectionIgnoreSqlCodes.add("XXXX");
+ ds.setDisconnectionIgnoreSqlCodes(disconnectionIgnoreSqlCodes);
+ ds.setFastFailValidation(true);
+ try (Connection conn = ds.getConnection()) { // Triggers initialization - pcf creation
+ // Make sure factory got the properties
+ final PoolableConnectionFactory pcf = (PoolableConnectionFactory) ds.getConnectionPool().getFactory();
+ assertTrue(pcf.isFastFailValidation());
+ assertTrue(pcf.getDisconnectionIgnoreSqlCodes().contains("XXXX"));
+ assertEquals(1, pcf.getDisconnectionIgnoreSqlCodes().size());
+ }
+ }
+
/**
* JIRA DBCP-333: Check that a custom class loader is used.
* @throws Exception
diff --git a/src/test/java/org/apache/commons/dbcp2/TestBasicDataSourceMXBean.java b/src/test/java/org/apache/commons/dbcp2/TestBasicDataSourceMXBean.java
index 246fef1511..d1227b0d23 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestBasicDataSourceMXBean.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestBasicDataSourceMXBean.java
@@ -83,6 +83,11 @@ public String[] getDisconnectionSqlCodesAsArray() {
return null;
}
+ @Override
+ public String[] getDisconnectionIgnoreSqlCodesAsArray() {
+ return null;
+ }
+
@Override
public String getDriverClassName() {
return null;
diff --git a/src/test/java/org/apache/commons/dbcp2/TestPoolableConnection.java b/src/test/java/org/apache/commons/dbcp2/TestPoolableConnection.java
index 30611d8c0e..4b7681fee4 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestPoolableConnection.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestPoolableConnection.java
@@ -25,6 +25,7 @@
import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
+import java.util.Arrays;
import javax.management.OperationsException;
@@ -182,6 +183,27 @@ public void testMXBeanCompliance() throws OperationsException {
TestBasicDataSourceMXBean.testMXBeanCompliance(PoolableConnectionMXBean.class);
}
+ @Test
+ public void testDisconnectionIgnoreSqlCodes() throws Exception {
+ pool.setTestOnReturn(true);
+ final PoolableConnectionFactory factory = (PoolableConnectionFactory) pool.getFactory();
+ factory.setFastFailValidation(true);
+ factory.setDisconnectionIgnoreSqlCodes(Arrays.asList("08S02", "08007"));
+
+ final PoolableConnection conn = pool.borrowObject();
+ final TesterConnection nativeConnection = (TesterConnection) conn.getInnermostDelegate();
+
+ // set up non-fatal exception
+ nativeConnection.setFailure(new SQLException("Non-fatal connection error.", "08S02"));
+ assertThrows(SQLException.class, conn::createStatement);
+ nativeConnection.setFailure(null);
+
+ // verify that non-fatal connection is returned to the pool
+ conn.close();
+ assertEquals(0, pool.getNumActive(), "The pool should have no active connections");
+ assertEquals(1, pool.getNumIdle(), "The pool should have one idle connection");
+ }
+
// Bugzilla Bug 33591: PoolableConnection leaks connections if the
// delegated connection closes itself.
@Test
diff --git a/src/test/java/org/apache/commons/dbcp2/TestUtils.java b/src/test/java/org/apache/commons/dbcp2/TestUtils.java
index 490ee6d6a7..30bd871593 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestUtils.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestUtils.java
@@ -19,12 +19,70 @@
import org.junit.jupiter.api.Test;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
public class TestUtils {
public static PStmtKey getPStmtKey(final PoolablePreparedStatement poolablePreparedStatement) {
return poolablePreparedStatement.getKey();
}
+ @Test
+ public void testCheckForConflictsWithOverlap() {
+ Collection codes1 = new HashSet<>(Arrays.asList("08003", "08006"));
+ Collection codes2 = new HashSet<>(Arrays.asList("08005", "08006"));
+
+ IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> {
+ Utils.checkForConflicts(codes1, codes2, "codes1", "codes2");
+ });
+
+ assertEquals("08006 cannot be in both codes1 and codes2.", exception.getMessage());
+ }
+
+ @Test
+ public void testCheckForConflictsNoOverlap() {
+ Collection codes1 = new HashSet<>(Arrays.asList("08003", "08006"));
+ Collection codes2 = new HashSet<>(Arrays.asList("08005", "08007"));
+
+ assertDoesNotThrow(() -> Utils.checkForConflicts(codes1, codes2, "codes1", "codes2"));
+ }
+
+ @Test
+ public void testCheckForConflictsFirstCollectionNull() {
+ Collection codes1 = null;
+ Collection codes2 = new HashSet<>(Arrays.asList("08005", "08007"));
+
+ assertDoesNotThrow(() -> Utils.checkForConflicts(codes1, codes2, "codes1", "codes2"));
+ }
+
+ @Test
+ public void testCheckForConflictsSecondCollectionNull() {
+ Collection codes1 = new HashSet<>(Arrays.asList("08003", "08006"));
+ Collection codes2 = null;
+
+ assertDoesNotThrow(() -> Utils.checkForConflicts(codes1, codes2, "codes1", "codes2"));
+ }
+
+ @Test
+ public void testCheckForConflictsBothCollectionsNull() {
+ assertDoesNotThrow(() -> Utils.checkForConflicts(null, null, "codes1", "codes2"));
+ }
+
+ @Test
+ public void testCheckForConflictsEmptyCollections() {
+ Collection codes1 = Collections.emptySet();
+ Collection codes2 = Collections.emptySet();
+
+ assertDoesNotThrow(() -> Utils.checkForConflicts(codes1, codes2, "codes1", "codes2"));
+ }
+
@Test
public void testClassLoads() {
Utils.closeQuietly((AutoCloseable) null);
From 6cc5ada2e7e47e24d35b79c6b98e08ebf2b7b1f2 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 19 Aug 2024 12:18:18 -0400
Subject: [PATCH 065/169] Add support for ignoring non-fatal SQL state codes.
#421
---
src/changes/changes.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index e3341bcafe..bd523a9580 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -72,6 +72,7 @@ The type attribute can be add,update,fix,remove.
Fix SpotBugs MC_OVERRIDABLE_METHOD_CALL_IN_READ_OBJECT in PerUserPoolDataSource.Fix SpotBugs MC_OVERRIDABLE_METHOD_CALL_IN_READ_OBJECT in SharedPoolDataSource.
+ Add support for ignoring non-fatal SQL state codes #421.Bump org.apache.commons:commons-parent from 66 to 73 #360, #371, #395, #420.Bump commons-logging:commons-logging from 1.3.0 to 1.3.4 #368, #399, #423.
From fb4106db86bf66a530f655026a79b60e6956dbcf Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 19 Aug 2024 12:55:35 -0400
Subject: [PATCH 066/169] Add support for ignoring non-fatal SQL state codes
#421
- Error message should contain all SQL codes in conflict
- Do not use static imports (only used these in unit tests)
- Javadoc: Empty line before tags
- Javadoc: Add missing sentences
- Javadoc: @since tag is last in new elements
- Use longer lines
- Reduce redundant boilerplace
- Sort members
- Flip error message
- Use final
- Less whitespace
- Simpler lambdas (less boilerplate)
---
.../apache/commons/dbcp2/BasicDataSource.java | 108 +++++++++---------
.../commons/dbcp2/DataSourceMXBean.java | 16 +--
.../commons/dbcp2/PoolableConnection.java | 1 +
.../dbcp2/PoolableConnectionFactory.java | 66 +++++------
.../java/org/apache/commons/dbcp2/Utils.java | 51 +++++----
.../dbcp2/managed/BasicManagedDataSource.java | 3 +-
.../managed/PoolableManagedConnection.java | 21 ++--
.../commons/dbcp2/TestBasicDataSource.java | 108 ++++++++----------
.../dbcp2/TestBasicDataSourceMXBean.java | 4 +-
.../dbcp2/TestDelegatingDatabaseMetaData.java | 8 +-
.../commons/dbcp2/TestPoolableConnection.java | 42 +++----
.../org/apache/commons/dbcp2/TestUtils.java | 64 +++++------
.../cpdsadapter/TestDriverAdapterCPDS.java | 1 -
13 files changed, 238 insertions(+), 255 deletions(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java b/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
index b7e3fe5113..963010286d 100644
--- a/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
@@ -16,8 +16,6 @@
*/
package org.apache.commons.dbcp2;
-import static org.apache.commons.dbcp2.Utils.checkForConflicts;
-
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
@@ -60,7 +58,6 @@
/**
* Basic implementation of {@code javax.sql.DataSource} that is configured via JavaBeans properties.
- *
*
* This is not the only way to combine the commons-dbcp2 and commons-pool2 packages, but provides a
* one-stop solution for basic requirements.
@@ -350,6 +347,7 @@ protected static void validateConnectionFactory(final PoolableConnectionFactory
/**
* A collection of SQL State codes that are not considered fatal disconnection codes.
+ *
* @since 2.13.0
*/
private volatile Set disconnectionIgnoreSqlCodes;
@@ -861,18 +859,6 @@ public int getDefaultTransactionIsolation() {
return this.defaultTransactionIsolation;
}
- /**
- * Gets the set of SQL State codes considered to signal fatal conditions.
- *
- * @return fatal disconnection state codes
- * @see #setDisconnectionSqlCodes(Collection)
- * @since 2.1
- */
- public Set getDisconnectionSqlCodes() {
- final Set result = disconnectionSqlCodes;
- return result == null ? Collections.emptySet() : result;
- }
-
/**
* Gets the set of SQL State codes that are not considered fatal disconnection codes.
*
@@ -890,23 +876,35 @@ public Set getDisconnectionIgnoreSqlCodes() {
}
/**
- * Provides the same data as {@link #getDisconnectionSqlCodes} but in an array so it is accessible via JMX.
+ * Provides the same data as {@link #getDisconnectionIgnoreSqlCodes()} but in an array, so it is accessible via JMX.
*
- * @since 2.1
+ * @since 2.13.0
*/
@Override
- public String[] getDisconnectionSqlCodesAsArray() {
- return getDisconnectionSqlCodes().toArray(Utils.EMPTY_STRING_ARRAY);
+ public String[] getDisconnectionIgnoreSqlCodesAsArray() {
+ return getDisconnectionIgnoreSqlCodes().toArray(Utils.EMPTY_STRING_ARRAY);
}
/**
- * Provides the same data as {@link #getDisconnectionIgnoreSqlCodes()} but in an array, so it is accessible via JMX.
+ * Gets the set of SQL State codes considered to signal fatal conditions.
*
- * @since 2.13.0
+ * @return fatal disconnection state codes
+ * @see #setDisconnectionSqlCodes(Collection)
+ * @since 2.1
+ */
+ public Set getDisconnectionSqlCodes() {
+ final Set result = disconnectionSqlCodes;
+ return result == null ? Collections.emptySet() : result;
+ }
+
+ /**
+ * Provides the same data as {@link #getDisconnectionSqlCodes} but in an array so it is accessible via JMX.
+ *
+ * @since 2.1
*/
@Override
- public String[] getDisconnectionIgnoreSqlCodesAsArray() {
- return getDisconnectionIgnoreSqlCodes().toArray(Utils.EMPTY_STRING_ARRAY);
+ public String[] getDisconnectionSqlCodesAsArray() {
+ return getDisconnectionSqlCodes().toArray(Utils.EMPTY_STRING_ARRAY);
}
/**
@@ -1980,36 +1978,6 @@ public void setDefaultTransactionIsolation(final int defaultTransactionIsolation
this.defaultTransactionIsolation = defaultTransactionIsolation;
}
- /**
- * Sets the SQL State codes considered to signal fatal conditions.
- *
- * Overrides the defaults in {@link Utils#getDisconnectionSqlCodes()} (plus anything starting with
- * {@link Utils#DISCONNECTION_SQL_CODE_PREFIX}). If this property is non-null and {@link #getFastFailValidation()}
- * is {@code true}, whenever connections created by this datasource generate exceptions with SQL State codes in this
- * list, they will be marked as "fatally disconnected" and subsequent validations will fail fast (no attempt at
- * isValid or validation query).
- *
- *
- * If {@link #getFastFailValidation()} is {@code false} setting this property has no effect.
- *
- *
- * 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}.
- *
- *
- * @param disconnectionSqlCodes SQL State codes considered to signal fatal conditions
- * @since 2.1
- * @throws IllegalArgumentException if any SQL state codes overlap with those in {@link #disconnectionIgnoreSqlCodes}.
- */
- public void setDisconnectionSqlCodes(final Collection disconnectionSqlCodes) {
- checkForConflicts(disconnectionSqlCodes, this.disconnectionIgnoreSqlCodes,
- "disconnectionSqlCodes", "disconnectionIgnoreSqlCodes");
- final Set collect = Utils.isEmpty(disconnectionSqlCodes) ? null
- : disconnectionSqlCodes.stream().filter(s -> !isEmpty(s)).collect(Collectors.toSet());
- this.disconnectionSqlCodes = Utils.isEmpty(collect) ? null : collect;
- }
-
/**
* Sets the SQL State codes that should be ignored when determining fatal disconnection conditions.
*
@@ -2030,17 +1998,45 @@ public void setDisconnectionSqlCodes(final Collection disconnectionSqlCo
*
*
* @param disconnectionIgnoreSqlCodes SQL State codes that should be ignored in disconnection checks
- * @since 2.13.0
* @throws IllegalArgumentException if any SQL state codes overlap with those in {@link #disconnectionSqlCodes}.
+ * @since 2.13.0
*/
public void setDisconnectionIgnoreSqlCodes(final Collection disconnectionIgnoreSqlCodes) {
- checkForConflicts(disconnectionIgnoreSqlCodes, this.disconnectionSqlCodes,
- "disconnectionIgnoreSqlCodes", "disconnectionSqlCodes");
+ Utils.checkSqlCodes(disconnectionIgnoreSqlCodes, this.disconnectionSqlCodes);
final Set collect = Utils.isEmpty(disconnectionIgnoreSqlCodes) ? null
: disconnectionIgnoreSqlCodes.stream().filter(s -> !isEmpty(s)).collect(Collectors.toSet());
this.disconnectionIgnoreSqlCodes = Utils.isEmpty(collect) ? null : collect;
}
+ /**
+ * Sets the SQL State codes considered to signal fatal conditions.
+ *
+ * Overrides the defaults in {@link Utils#getDisconnectionSqlCodes()} (plus anything starting with
+ * {@link Utils#DISCONNECTION_SQL_CODE_PREFIX}). If this property is non-null and {@link #getFastFailValidation()}
+ * is {@code true}, whenever connections created by this datasource generate exceptions with SQL State codes in this
+ * list, they will be marked as "fatally disconnected" and subsequent validations will fail fast (no attempt at
+ * isValid or validation query).
+ *
+ *
+ * If {@link #getFastFailValidation()} is {@code false} setting this property has no effect.
+ *
+ *
+ * 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}.
+ *
+ *
+ * @param disconnectionSqlCodes SQL State codes considered to signal fatal conditions
+ * @since 2.1
+ * @throws IllegalArgumentException if any SQL state codes overlap with those in {@link #disconnectionIgnoreSqlCodes}.
+ */
+ public void setDisconnectionSqlCodes(final Collection disconnectionSqlCodes) {
+ Utils.checkSqlCodes(disconnectionSqlCodes, this.disconnectionIgnoreSqlCodes);
+ final Set collect = Utils.isEmpty(disconnectionSqlCodes) ? null
+ : disconnectionSqlCodes.stream().filter(s -> !isEmpty(s)).collect(Collectors.toSet());
+ this.disconnectionSqlCodes = Utils.isEmpty(collect) ? null : collect;
+ }
+
/**
* Sets the JDBC Driver instance to use for this pool.
*
diff --git a/src/main/java/org/apache/commons/dbcp2/DataSourceMXBean.java b/src/main/java/org/apache/commons/dbcp2/DataSourceMXBean.java
index 3c55187bc7..c28bd1f616 100644
--- a/src/main/java/org/apache/commons/dbcp2/DataSourceMXBean.java
+++ b/src/main/java/org/apache/commons/dbcp2/DataSourceMXBean.java
@@ -85,14 +85,6 @@ default String getDefaultSchema() {
*/
int getDefaultTransactionIsolation();
- /**
- * See {@link BasicDataSource#getDisconnectionSqlCodesAsArray()}.
- *
- * @return {@link BasicDataSource#getDisconnectionSqlCodesAsArray()}.
- * @since 2.1
- */
- String[] getDisconnectionSqlCodesAsArray();
-
/**
* See {@link BasicDataSource#getDisconnectionIgnoreSqlCodesAsArray()}.
*
@@ -103,6 +95,14 @@ default String[] getDisconnectionIgnoreSqlCodesAsArray() {
return Utils.EMPTY_STRING_ARRAY;
}
+ /**
+ * See {@link BasicDataSource#getDisconnectionSqlCodesAsArray()}.
+ *
+ * @return {@link BasicDataSource#getDisconnectionSqlCodesAsArray()}.
+ * @since 2.1
+ */
+ String[] getDisconnectionSqlCodesAsArray();
+
/**
* See {@link BasicDataSource#getDriverClassName()}.
*
diff --git a/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java b/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java
index 2694022162..612560a3d0 100644
--- a/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java
+++ b/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java
@@ -78,6 +78,7 @@ public class PoolableConnection extends DelegatingConnection impleme
/**
* A collection of SQL State codes that are not considered fatal disconnection codes.
+ *
* @since 2.13.0
*/
private final Collection disconnectionIgnoreSqlCodes;
diff --git a/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java b/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java
index ff6d05131f..c2f12d2e5a 100644
--- a/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java
+++ b/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java
@@ -16,8 +16,6 @@
*/
package org.apache.commons.dbcp2;
-import static org.apache.commons.dbcp2.Utils.checkForConflicts;
-
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
@@ -275,7 +273,22 @@ public int getDefaultTransactionIsolation() {
}
/**
- * SQL State codes considered to signal fatal conditions.
+ * Gets the collection of SQL State codes that are not considered fatal disconnection codes.
+ *
+ * This method returns the collection of SQL State codes that have been set to be ignored when
+ * determining if a {@link SQLException} signals a disconnection. These codes are excluded from
+ * being treated as fatal even if they match the typical disconnection criteria.
+ *
+ *
+ * @return a {@link Collection} of SQL State codes that should be ignored for disconnection checks.
+ * @since 2.13.0
+ */
+ public Collection getDisconnectionIgnoreSqlCodes() {
+ return disconnectionIgnoreSqlCodes;
+ }
+
+ /**
+ * Gets SQL State codes considered to signal fatal conditions.
*
* Overrides the defaults in {@link Utils#getDisconnectionSqlCodes()} (plus anything starting with
* {@link Utils#DISCONNECTION_SQL_CODE_PREFIX}). If this property is non-null and {@link #isFastFailValidation()} is
@@ -294,21 +307,6 @@ public Collection getDisconnectionSqlCodes() {
return disconnectionSqlCodes;
}
- /**
- * Retrieves the collection of SQL State codes that are not considered fatal disconnection codes.
- *
- * This method returns the collection of SQL State codes that have been set to be ignored when
- * determining if a {@link SQLException} signals a disconnection. These codes are excluded from
- * being treated as fatal even if they match the typical disconnection criteria.
- *
- *
- * @return a {@link Collection} of SQL State codes that should be ignored for disconnection checks.
- * @since 2.13.0
- */
- public Collection getDisconnectionIgnoreSqlCodes() {
- return disconnectionIgnoreSqlCodes;
- }
-
/**
* Gets the Maximum connection duration.
*
@@ -622,6 +620,22 @@ public void setDefaultTransactionIsolation(final int defaultTransactionIsolation
}
/**
+ * Sets the disconnection SQL codes to ignore.
+ *
+ * @param disconnectionIgnoreSqlCodes
+ * The collection of SQL State codes to be ignored.
+ * @see #getDisconnectionIgnoreSqlCodes()
+ * @throws IllegalArgumentException if any SQL state codes overlap with those in {@link #disconnectionSqlCodes}.
+ * @since 2.13.0
+ */
+ public void setDisconnectionIgnoreSqlCodes(Collection disconnectionIgnoreSqlCodes) {
+ Utils.checkSqlCodes(disconnectionIgnoreSqlCodes, this.disconnectionSqlCodes);
+ this.disconnectionIgnoreSqlCodes = disconnectionIgnoreSqlCodes;
+ }
+
+ /**
+ * Sets the disconnection SQL codes.
+ *
* @param disconnectionSqlCodes
* The disconnection SQL codes.
* @see #getDisconnectionSqlCodes()
@@ -629,24 +643,10 @@ public void setDefaultTransactionIsolation(final int defaultTransactionIsolation
* @throws IllegalArgumentException if any SQL state codes overlap with those in {@link #disconnectionIgnoreSqlCodes}.
*/
public void setDisconnectionSqlCodes(final Collection disconnectionSqlCodes) {
- checkForConflicts(disconnectionSqlCodes, this.disconnectionIgnoreSqlCodes,
- "disconnectionSqlCodes", "disconnectionIgnoreSqlCodes");
+ Utils.checkSqlCodes(disconnectionSqlCodes, this.disconnectionIgnoreSqlCodes);
this.disconnectionSqlCodes = disconnectionSqlCodes;
}
- /**
- * @param disconnectionIgnoreSqlCodes
- * The collection of SQL State codes to be ignored.
- * @see #getDisconnectionIgnoreSqlCodes()
- * @since 2.13.0
- * @throws IllegalArgumentException if any SQL state codes overlap with those in {@link #disconnectionSqlCodes}.
- */
- public void setDisconnectionIgnoreSqlCodes(Collection disconnectionIgnoreSqlCodes) {
- checkForConflicts(disconnectionIgnoreSqlCodes, this.disconnectionSqlCodes,
- "disconnectionIgnoreSqlCodes", "disconnectionSqlCodes");
- this.disconnectionIgnoreSqlCodes = disconnectionIgnoreSqlCodes;
- }
-
/**
* @param autoCommitOnReturn Whether to auto-commit on return.
* @deprecated Use {@link #setAutoCommitOnReturn(boolean)}.
diff --git a/src/main/java/org/apache/commons/dbcp2/Utils.java b/src/main/java/org/apache/commons/dbcp2/Utils.java
index ad927225c6..6f236c525d 100644
--- a/src/main/java/org/apache/commons/dbcp2/Utils.java
+++ b/src/main/java/org/apache/commons/dbcp2/Utils.java
@@ -82,6 +82,34 @@ public final class Utils {
DISCONNECTION_SQL_CODES.add("JZ0C1"); // Sybase disconnect error
}
+ /**
+ * Checks for conflicts between two collections.
+ *
+ * If any overlap is found between the two provided collections, an {@link IllegalArgumentException} is thrown.
+ *
+ *
+ * @param codes1 The first collection of SQL state codes.
+ * @param codes2 The second collection of SQL state codes.
+ * @throws IllegalArgumentException if any codes overlap between the two collections.
+ * @since 2.13.0
+ */
+ static void checkSqlCodes(final Collection codes1, final Collection codes2) {
+// if (codes1 != null && codes2 != null) {
+// for (String code : codes1) {
+// if (codes2.contains(code)) {
+// throw new IllegalArgumentException(code + " cannot be in both disconnectionSqlCodes and disconnectionIgnoreSqlCodes.");
+// }
+// }
+// }
+ if (codes1 != null && codes2 != null) {
+ final Set test = new HashSet<>(codes1);
+ test.retainAll(codes2);
+ if (!test.isEmpty()) {
+ throw new IllegalArgumentException(test + " cannot be in both disconnectionSqlCodes and disconnectionIgnoreSqlCodes.");
+ }
+ }
+ }
+
/**
* Clones the given char[] if not null.
*
@@ -138,29 +166,6 @@ public static void closeQuietly(final AutoCloseable autoCloseable) {
close(autoCloseable, null);
}
- /**
- * Checks for conflicts between two collections.
- *
- * If any overlap is found between the two provided collections, an {@link IllegalArgumentException} is thrown.
- *
- *
- * @param codes1 The first collection of SQL state codes.
- * @param codes2 The second collection of SQL state codes.
- * @param name1 The name of the first collection (for exception message).
- * @param name2 The name of the second collection (for exception message).
- * @since 2.13.0
- * @throws IllegalArgumentException if any codes overlap between the two collections.
- */
- static void checkForConflicts(Collection codes1, Collection codes2, String name1, String name2) {
- if (codes1 != null && codes2 != null) {
- for (String code : codes1) {
- if (codes2.contains(code)) {
- throw new IllegalArgumentException(code + " cannot be in both " + name1 + " and " + name2 + ".");
- }
- }
- }
- }
-
/**
* Closes the Connection (which may be null).
*
diff --git a/src/main/java/org/apache/commons/dbcp2/managed/BasicManagedDataSource.java b/src/main/java/org/apache/commons/dbcp2/managed/BasicManagedDataSource.java
index c293e27cd2..9bd1c99354 100644
--- a/src/main/java/org/apache/commons/dbcp2/managed/BasicManagedDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/managed/BasicManagedDataSource.java
@@ -126,8 +126,7 @@ protected PoolableConnectionFactory createPoolableConnectionFactory(final Connec
throws SQLException {
PoolableConnectionFactory connectionFactory = null;
try {
- connectionFactory = new PoolableManagedConnectionFactory((XAConnectionFactory) driverConnectionFactory,
- getRegisteredJmxName());
+ connectionFactory = new PoolableManagedConnectionFactory((XAConnectionFactory) driverConnectionFactory, getRegisteredJmxName());
connectionFactory.setValidationQuery(getValidationQuery());
connectionFactory.setValidationQueryTimeout(getValidationQueryTimeoutDuration());
connectionFactory.setConnectionInitSql(getConnectionInitSqls());
diff --git a/src/main/java/org/apache/commons/dbcp2/managed/PoolableManagedConnection.java b/src/main/java/org/apache/commons/dbcp2/managed/PoolableManagedConnection.java
index 5eea0397de..2be2e1a4f1 100644
--- a/src/main/java/org/apache/commons/dbcp2/managed/PoolableManagedConnection.java
+++ b/src/main/java/org/apache/commons/dbcp2/managed/PoolableManagedConnection.java
@@ -33,7 +33,7 @@ public class PoolableManagedConnection extends PoolableConnection {
private final TransactionRegistry transactionRegistry;
/**
- * Create a PoolableManagedConnection.
+ * Creates a PoolableManagedConnection.
*
* @param transactionRegistry
* transaction registry
@@ -42,13 +42,12 @@ public class PoolableManagedConnection extends PoolableConnection {
* @param pool
* connection pool
*/
- public PoolableManagedConnection(final TransactionRegistry transactionRegistry, final Connection conn,
- final ObjectPool pool) {
+ public PoolableManagedConnection(final TransactionRegistry transactionRegistry, final Connection conn, final ObjectPool pool) {
this(transactionRegistry, conn, pool, null, true);
}
/**
- * Create a PoolableManagedConnection.
+ * Creates a PoolableManagedConnection.
*
* @param transactionRegistry
* transaction registry
@@ -62,14 +61,13 @@ public PoolableManagedConnection(final TransactionRegistry transactionRegistry,
* true means fatal disconnection errors cause subsequent validations to fail immediately (no attempt to
* run query or isValid)
*/
- public PoolableManagedConnection(final TransactionRegistry transactionRegistry, final Connection conn,
- final ObjectPool pool, final Collection disconnectSqlCodes,
- final boolean fastFailValidation) {
+ public PoolableManagedConnection(final TransactionRegistry transactionRegistry, final Connection conn, final ObjectPool pool,
+ final Collection disconnectSqlCodes, final boolean fastFailValidation) {
this(transactionRegistry, conn, pool, disconnectSqlCodes, null, fastFailValidation);
}
/**
- * Create a PoolableManagedConnection.
+ * Creates a PoolableManagedConnection.
*
* @param transactionRegistry
* transaction registry
@@ -86,14 +84,15 @@ public PoolableManagedConnection(final TransactionRegistry transactionRegistry,
* run query or isValid)
* @since 2.13.0
*/
- public PoolableManagedConnection(final TransactionRegistry transactionRegistry, final Connection conn,
- final ObjectPool pool, final Collection disconnectSqlCodes,
- final Collection disconnectionIgnoreSqlCodes, final boolean fastFailValidation) {
+ public PoolableManagedConnection(final TransactionRegistry transactionRegistry, final Connection conn, final ObjectPool pool,
+ final Collection disconnectSqlCodes, final Collection disconnectionIgnoreSqlCodes, final boolean fastFailValidation) {
super(conn, pool, null, disconnectSqlCodes, disconnectionIgnoreSqlCodes, fastFailValidation);
this.transactionRegistry = transactionRegistry;
}
/**
+ * Gets the transaction registry.
+ *
* @return The transaction registry.
* @since 2.6.0
*/
diff --git a/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java b/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java
index 3b3ec7ed50..66c852d1c1 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java
@@ -440,6 +440,21 @@ public void testDeprecatedAccessors() throws SQLException {
}
}
+ @Test
+ public void testDisconnectionIgnoreSqlCodes() throws Exception {
+ final ArrayList disconnectionIgnoreSqlCodes = new ArrayList<>();
+ disconnectionIgnoreSqlCodes.add("XXXX");
+ ds.setDisconnectionIgnoreSqlCodes(disconnectionIgnoreSqlCodes);
+ ds.setFastFailValidation(true);
+ try (Connection conn = ds.getConnection()) { // Triggers initialization - pcf creation
+ // Make sure factory got the properties
+ final PoolableConnectionFactory pcf = (PoolableConnectionFactory) ds.getConnectionPool().getFactory();
+ assertTrue(pcf.isFastFailValidation());
+ assertTrue(pcf.getDisconnectionIgnoreSqlCodes().contains("XXXX"));
+ assertEquals(1, pcf.getDisconnectionIgnoreSqlCodes().size());
+ }
+ }
+
/**
* JIRA: DBCP-437
* Verify that BasicDataSource sets disconnect codes properties.
@@ -460,51 +475,6 @@ public void testDisconnectSqlCodes() throws Exception {
}
}
- @Test
- public void testOverlapBetweenDisconnectionAndIgnoreSqlCodes() {
- // Set initial disconnection SQL codes
- final HashSet disconnectionSqlCodes = new HashSet<>(Arrays.asList("XXX", "ZZZ"));
- ds.setDisconnectionSqlCodes(disconnectionSqlCodes);
-
- // Try setting ignore SQL codes with overlap
- final HashSet disconnectionIgnoreSqlCodes = new HashSet<>(Arrays.asList("YYY", "XXX"));
-
- IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> {
- ds.setDisconnectionIgnoreSqlCodes(disconnectionIgnoreSqlCodes);
- });
-
- assertEquals("XXX cannot be in both disconnectionIgnoreSqlCodes and disconnectionSqlCodes.", exception.getMessage());
- }
-
- @Test
- public void testNoOverlapBetweenDisconnectionAndIgnoreSqlCodes() {
- // Set disconnection SQL codes without overlap
- final HashSet disconnectionSqlCodes = new HashSet<>(Arrays.asList("XXX", "ZZZ"));
- ds.setDisconnectionSqlCodes(disconnectionSqlCodes);
-
- // Set ignore SQL codes without overlap
- final HashSet disconnectionIgnoreSqlCodes = new HashSet<>(Arrays.asList("YYY", "AAA"));
- ds.setDisconnectionIgnoreSqlCodes(disconnectionIgnoreSqlCodes);
-
- assertEquals(disconnectionSqlCodes, ds.getDisconnectionSqlCodes(), "Disconnection SQL codes should match the set values.");
- assertEquals(disconnectionIgnoreSqlCodes, ds.getDisconnectionIgnoreSqlCodes(), "Disconnection Ignore SQL codes should match the set values.");
- }
-
- @Test
- public void testDisconnectionIgnoreSqlCodes() throws Exception {
- final ArrayList disconnectionIgnoreSqlCodes = new ArrayList<>();
- disconnectionIgnoreSqlCodes.add("XXXX");
- ds.setDisconnectionIgnoreSqlCodes(disconnectionIgnoreSqlCodes);
- ds.setFastFailValidation(true);
- try (Connection conn = ds.getConnection()) { // Triggers initialization - pcf creation
- // Make sure factory got the properties
- final PoolableConnectionFactory pcf = (PoolableConnectionFactory) ds.getConnectionPool().getFactory();
- assertTrue(pcf.isFastFailValidation());
- assertTrue(pcf.getDisconnectionIgnoreSqlCodes().contains("XXXX"));
- assertEquals(1, pcf.getDisconnectionIgnoreSqlCodes().size());
- }
- }
-
/**
* JIRA DBCP-333: Check that a custom class loader is used.
* @throws Exception
@@ -628,15 +598,15 @@ public void testInvalidateConnection() throws Exception {
}
@Test
- public void testInvalidConnectionInitSqlList() {
- ds.setConnectionInitSqls(Arrays.asList("SELECT 1", "invalid"));
+ public void testInvalidConnectionInitSqlCollection() {
+ ds.setConnectionInitSqls((Collection) Arrays.asList("SELECT 1", "invalid"));
final SQLException e = assertThrows(SQLException.class, ds::getConnection);
assertTrue(e.toString().contains("invalid"));
}
@Test
- public void testInvalidConnectionInitSqlCollection() {
- ds.setConnectionInitSqls((Collection) Arrays.asList("SELECT 1", "invalid"));
+ public void testInvalidConnectionInitSqlList() {
+ ds.setConnectionInitSqls(Arrays.asList("SELECT 1", "invalid"));
final SQLException e = assertThrows(SQLException.class, ds::getConnection);
assertTrue(e.toString().contains("invalid"));
}
@@ -704,23 +674,14 @@ public void testJmxDisabled() throws Exception {
@Test
public void testJmxDoesNotExposePassword() throws Exception {
final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
-
try (Connection c = ds.getConnection()) {
// nothing
}
final ObjectName objectName = new ObjectName(ds.getJmxName());
-
final MBeanAttributeInfo[] attributes = mbs.getMBeanInfo(objectName).getAttributes();
-
assertTrue(attributes != null && attributes.length > 0);
-
- Arrays.asList(attributes).forEach(attrInfo -> {
- assertFalse("password".equalsIgnoreCase(attrInfo.getName()));
- });
-
- assertThrows(AttributeNotFoundException.class, () -> {
- mbs.getAttribute(objectName, "Password");
- });
+ Arrays.asList(attributes).forEach(attrInfo -> assertFalse("password".equalsIgnoreCase(attrInfo.getName())));
+ assertThrows(AttributeNotFoundException.class, () -> mbs.getAttribute(objectName, "Password"));
}
@Test
@@ -830,6 +791,33 @@ public void testNoAccessToUnderlyingConnectionAllowed() throws Exception {
}
}
+ @Test
+ public void testNoOverlapBetweenDisconnectionAndIgnoreSqlCodes() {
+ // Set disconnection SQL codes without overlap
+ final HashSet disconnectionSqlCodes = new HashSet<>(Arrays.asList("XXX", "ZZZ"));
+ ds.setDisconnectionSqlCodes(disconnectionSqlCodes);
+
+ // Set ignore SQL codes without overlap
+ final HashSet disconnectionIgnoreSqlCodes = new HashSet<>(Arrays.asList("YYY", "AAA"));
+ ds.setDisconnectionIgnoreSqlCodes(disconnectionIgnoreSqlCodes);
+
+ assertEquals(disconnectionSqlCodes, ds.getDisconnectionSqlCodes(), "Disconnection SQL codes should match the set values.");
+ assertEquals(disconnectionIgnoreSqlCodes, ds.getDisconnectionIgnoreSqlCodes(), "Disconnection Ignore SQL codes should match the set values.");
+ }
+
+ @Test
+ public void testOverlapBetweenDisconnectionAndIgnoreSqlCodes() {
+ // Set initial disconnection SQL codes
+ final HashSet disconnectionSqlCodes = new HashSet<>(Arrays.asList("XXX", "ZZZ"));
+ ds.setDisconnectionSqlCodes(disconnectionSqlCodes);
+ // Try setting ignore SQL codes with overlap
+ final HashSet disconnectionIgnoreSqlCodes = new HashSet<>(Arrays.asList("YYY", "XXX"));
+
+ final IllegalArgumentException exception = assertThrows(IllegalArgumentException.class,
+ () -> ds.setDisconnectionIgnoreSqlCodes(disconnectionIgnoreSqlCodes));
+ assertEquals("[XXX] cannot be in both disconnectionSqlCodes and disconnectionIgnoreSqlCodes.", exception.getMessage());
+ }
+
/**
* Verifies correct handling of exceptions generated by the underlying pool as it closes
* connections in response to BDS#close. Exceptions have to be either swallowed by the
diff --git a/src/test/java/org/apache/commons/dbcp2/TestBasicDataSourceMXBean.java b/src/test/java/org/apache/commons/dbcp2/TestBasicDataSourceMXBean.java
index d1227b0d23..56b78fc710 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestBasicDataSourceMXBean.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestBasicDataSourceMXBean.java
@@ -79,12 +79,12 @@ public int getDefaultTransactionIsolation() {
}
@Override
- public String[] getDisconnectionSqlCodesAsArray() {
+ public String[] getDisconnectionIgnoreSqlCodesAsArray() {
return null;
}
@Override
- public String[] getDisconnectionIgnoreSqlCodesAsArray() {
+ public String[] getDisconnectionSqlCodesAsArray() {
return null;
}
diff --git a/src/test/java/org/apache/commons/dbcp2/TestDelegatingDatabaseMetaData.java b/src/test/java/org/apache/commons/dbcp2/TestDelegatingDatabaseMetaData.java
index 74886cccac..05fed11441 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestDelegatingDatabaseMetaData.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestDelegatingDatabaseMetaData.java
@@ -772,12 +772,8 @@ public void testLocatorsUpdateCopy() throws Exception {
@Test
public void testNullArguments() throws Exception {
- assertThrows(NullPointerException.class, () -> {
- new DelegatingDatabaseMetaData(null, null);
- });
- assertThrows(NullPointerException.class, () -> {
- new DelegatingDatabaseMetaData(new DelegatingConnection(null), null);
- });
+ assertThrows(NullPointerException.class, () -> new DelegatingDatabaseMetaData(null, null));
+ assertThrows(NullPointerException.class, () -> new DelegatingDatabaseMetaData(new DelegatingConnection(null), null));
}
@Test
diff --git a/src/test/java/org/apache/commons/dbcp2/TestPoolableConnection.java b/src/test/java/org/apache/commons/dbcp2/TestPoolableConnection.java
index 4b7681fee4..d36e1ff468 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestPoolableConnection.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestPoolableConnection.java
@@ -90,6 +90,27 @@ public void testConnectionPool() throws Exception {
assertEquals(0, pool.getNumActive(), "There should now be zero active objects in the pool");
}
+ @Test
+ public void testDisconnectionIgnoreSqlCodes() throws Exception {
+ pool.setTestOnReturn(true);
+ final PoolableConnectionFactory factory = (PoolableConnectionFactory) pool.getFactory();
+ factory.setFastFailValidation(true);
+ factory.setDisconnectionIgnoreSqlCodes(Arrays.asList("08S02", "08007"));
+
+ final PoolableConnection conn = pool.borrowObject();
+ final TesterConnection nativeConnection = (TesterConnection) conn.getInnermostDelegate();
+
+ // set up non-fatal exception
+ nativeConnection.setFailure(new SQLException("Non-fatal connection error.", "08S02"));
+ assertThrows(SQLException.class, conn::createStatement);
+ nativeConnection.setFailure(null);
+
+ // verify that non-fatal connection is returned to the pool
+ conn.close();
+ assertEquals(0, pool.getNumActive(), "The pool should have no active connections");
+ assertEquals(1, pool.getNumIdle(), "The pool should have one idle connection");
+ }
+
@Test
public void testFastFailValidation() throws Exception {
pool.setTestOnReturn(true);
@@ -183,27 +204,6 @@ public void testMXBeanCompliance() throws OperationsException {
TestBasicDataSourceMXBean.testMXBeanCompliance(PoolableConnectionMXBean.class);
}
- @Test
- public void testDisconnectionIgnoreSqlCodes() throws Exception {
- pool.setTestOnReturn(true);
- final PoolableConnectionFactory factory = (PoolableConnectionFactory) pool.getFactory();
- factory.setFastFailValidation(true);
- factory.setDisconnectionIgnoreSqlCodes(Arrays.asList("08S02", "08007"));
-
- final PoolableConnection conn = pool.borrowObject();
- final TesterConnection nativeConnection = (TesterConnection) conn.getInnermostDelegate();
-
- // set up non-fatal exception
- nativeConnection.setFailure(new SQLException("Non-fatal connection error.", "08S02"));
- assertThrows(SQLException.class, conn::createStatement);
- nativeConnection.setFailure(null);
-
- // verify that non-fatal connection is returned to the pool
- conn.close();
- assertEquals(0, pool.getNumActive(), "The pool should have no active connections");
- assertEquals(1, pool.getNumIdle(), "The pool should have one idle connection");
- }
-
// Bugzilla Bug 33591: PoolableConnection leaks connections if the
// delegated connection closes itself.
@Test
diff --git a/src/test/java/org/apache/commons/dbcp2/TestUtils.java b/src/test/java/org/apache/commons/dbcp2/TestUtils.java
index 30bd871593..79d06eb0b9 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestUtils.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestUtils.java
@@ -17,16 +17,16 @@
package org.apache.commons.dbcp2;
-import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
-import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertThrows;
+import org.junit.jupiter.api.Test;
public class TestUtils {
@@ -35,52 +35,52 @@ public static PStmtKey getPStmtKey(final PoolablePreparedStatement poo
}
@Test
- public void testCheckForConflictsWithOverlap() {
- Collection codes1 = new HashSet<>(Arrays.asList("08003", "08006"));
- Collection codes2 = new HashSet<>(Arrays.asList("08005", "08006"));
-
- IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> {
- Utils.checkForConflicts(codes1, codes2, "codes1", "codes2");
- });
-
- assertEquals("08006 cannot be in both codes1 and codes2.", exception.getMessage());
+ public void testCheckForConflictsBothCollectionsNull() {
+ assertDoesNotThrow(() -> Utils.checkSqlCodes(null, null));
}
@Test
- public void testCheckForConflictsNoOverlap() {
- Collection codes1 = new HashSet<>(Arrays.asList("08003", "08006"));
- Collection codes2 = new HashSet<>(Arrays.asList("08005", "08007"));
-
- assertDoesNotThrow(() -> Utils.checkForConflicts(codes1, codes2, "codes1", "codes2"));
+ public void testCheckForConflictsEmptyCollections() {
+ final Collection codes1 = Collections.emptySet();
+ final Collection codes2 = Collections.emptySet();
+ assertDoesNotThrow(() -> Utils.checkSqlCodes(codes1, codes2));
}
@Test
public void testCheckForConflictsFirstCollectionNull() {
- Collection codes1 = null;
- Collection codes2 = new HashSet<>(Arrays.asList("08005", "08007"));
+ final Collection codes1 = null;
+ final Collection codes2 = new HashSet<>(Arrays.asList("08005", "08007"));
+ assertDoesNotThrow(() -> Utils.checkSqlCodes(codes1, codes2));
+ }
- assertDoesNotThrow(() -> Utils.checkForConflicts(codes1, codes2, "codes1", "codes2"));
+ @Test
+ public void testCheckForConflictsNoOverlap() {
+ final Collection codes1 = new HashSet<>(Arrays.asList("08003", "08006"));
+ final Collection codes2 = new HashSet<>(Arrays.asList("08005", "08007"));
+ assertDoesNotThrow(() -> Utils.checkSqlCodes(codes1, codes2));
}
@Test
public void testCheckForConflictsSecondCollectionNull() {
- Collection codes1 = new HashSet<>(Arrays.asList("08003", "08006"));
- Collection codes2 = null;
-
- assertDoesNotThrow(() -> Utils.checkForConflicts(codes1, codes2, "codes1", "codes2"));
+ final Collection codes1 = new HashSet<>(Arrays.asList("08003", "08006"));
+ final Collection codes2 = null;
+ assertDoesNotThrow(() -> Utils.checkSqlCodes(codes1, codes2));
}
@Test
- public void testCheckForConflictsBothCollectionsNull() {
- assertDoesNotThrow(() -> Utils.checkForConflicts(null, null, "codes1", "codes2"));
+ public void testCheckForConflictsWith1Overlap() {
+ final Collection codes1 = new HashSet<>(Arrays.asList("08003", "08006"));
+ final Collection codes2 = new HashSet<>(Arrays.asList("08005", "08006"));
+ final IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> Utils.checkSqlCodes(codes1, codes2));
+ assertEquals("[08006] cannot be in both disconnectionSqlCodes and disconnectionIgnoreSqlCodes.", exception.getMessage());
}
@Test
- public void testCheckForConflictsEmptyCollections() {
- Collection codes1 = Collections.emptySet();
- Collection codes2 = Collections.emptySet();
-
- assertDoesNotThrow(() -> Utils.checkForConflicts(codes1, codes2, "codes1", "codes2"));
+ public void testCheckForConflictsWith2Overlap() {
+ final Collection codes1 = new HashSet<>(Arrays.asList("08003", "08006", "08007"));
+ final Collection codes2 = new HashSet<>(Arrays.asList("08005", "08006", "08007"));
+ final IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> Utils.checkSqlCodes(codes1, codes2));
+ assertEquals("[08006, 08007] cannot be in both disconnectionSqlCodes and disconnectionIgnoreSqlCodes.", exception.getMessage());
}
@Test
diff --git a/src/test/java/org/apache/commons/dbcp2/cpdsadapter/TestDriverAdapterCPDS.java b/src/test/java/org/apache/commons/dbcp2/cpdsadapter/TestDriverAdapterCPDS.java
index 68573f42e4..737466690d 100644
--- a/src/test/java/org/apache/commons/dbcp2/cpdsadapter/TestDriverAdapterCPDS.java
+++ b/src/test/java/org/apache/commons/dbcp2/cpdsadapter/TestDriverAdapterCPDS.java
@@ -23,7 +23,6 @@
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
import java.io.PrintWriter;
import java.sql.Connection;
From f6fbc21ccf8840330f31ae7614dd708bbde22fe7 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 19 Aug 2024 12:56:30 -0400
Subject: [PATCH 067/169] Bump version to feature
---
pom.xml | 8 ++++----
src/changes/changes.xml | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/pom.xml b/pom.xml
index ac095d0a83..4aea96f66b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
4.0.0commons-dbcp2
- 2.12.1-SNAPSHOT
+ 2.13.0-SNAPSHOTApache Commons DBCP2001
@@ -181,8 +181,8 @@
RC1org.apache.commons.dbcp2
- 2.12.0
- 2.12.1
+ 2.13.0
+ 2.13.1for JDBC 4.2 on Java 8sha512
@@ -200,7 +200,7 @@
javax.transaction;version="1.1.0",javax.transaction.xa;version="1.1.0";partial=true;mandatory:=partial,*true
- 2.11.0
+ 2.12.0truefalsefalse
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index bd523a9580..71037c5435 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -62,7 +62,7 @@ The type attribute can be add,update,fix,remove.
EvictionTimer
-->
-
+ Fix PMD UnnecessaryFullyQualifiedName in AbandonedTrace.Fix PMD UnnecessaryFullyQualifiedName in PoolableCallableStatement.
From f57c9fef0d55e6faaac89c86786cf1319c984b80 Mon Sep 17 00:00:00 2001
From: Johno Crawford
Date: Mon, 19 Aug 2024 19:28:28 +0200
Subject: [PATCH 068/169] Avoid object creation when invoking
isDisconnectionSqlException. (#422)
* Avoid object creation when invoking isDisconnectionSqlException.
* Update since tag.
---
.../apache/commons/dbcp2/PoolableConnection.java | 2 +-
.../java/org/apache/commons/dbcp2/Utils.java | 11 +++++++++++
.../java/org/apache/commons/dbcp2/TestUtils.java | 16 ++++++++++++++--
3 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java b/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java
index 612560a3d0..01ce941deb 100644
--- a/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java
+++ b/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java
@@ -305,7 +305,7 @@ boolean isDisconnectionSqlException(final SQLException e) {
return false;
}
fatalException = disconnectionSqlCodes == null
- ? sqlState.startsWith(Utils.DISCONNECTION_SQL_CODE_PREFIX) || Utils.getDisconnectionSqlCodes().contains(sqlState)
+ ? sqlState.startsWith(Utils.DISCONNECTION_SQL_CODE_PREFIX) || Utils.isDisconnectionSqlCode(sqlState)
: disconnectionSqlCodes.contains(sqlState);
}
return fatalException;
diff --git a/src/main/java/org/apache/commons/dbcp2/Utils.java b/src/main/java/org/apache/commons/dbcp2/Utils.java
index 6f236c525d..e9324adb6b 100644
--- a/src/main/java/org/apache/commons/dbcp2/Utils.java
+++ b/src/main/java/org/apache/commons/dbcp2/Utils.java
@@ -216,6 +216,17 @@ public static Set getDisconnectionSqlCodes() {
return new HashSet<>(DISCONNECTION_SQL_CODES);
}
+ /**
+ * Checks if the given SQL state corresponds to a fatal connection error.
+ *
+ * @param sqlState the SQL state to check.
+ * @return true if the SQL state is a fatal connection error, false otherwise.
+ * @since 2.13.0
+ */
+ static boolean isDisconnectionSqlCode(String sqlState) {
+ return DISCONNECTION_SQL_CODES.contains(sqlState);
+ }
+
/**
* Gets the correct i18n message for the given key.
*
diff --git a/src/test/java/org/apache/commons/dbcp2/TestUtils.java b/src/test/java/org/apache/commons/dbcp2/TestUtils.java
index 79d06eb0b9..395d25b26b 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestUtils.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestUtils.java
@@ -19,15 +19,17 @@
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
-import org.junit.jupiter.api.Test;
-
public class TestUtils {
public static PStmtKey getPStmtKey(final PoolablePreparedStatement poolablePreparedStatement) {
@@ -87,4 +89,14 @@ public void testCheckForConflictsWith2Overlap() {
public void testClassLoads() {
Utils.closeQuietly((AutoCloseable) null);
}
+
+ @Test
+ public void testIsDisconnectionSqlCode() {
+ assertTrue(Utils.isDisconnectionSqlCode("57P01"), "57P01 should be recognised as a disconnection SQL code.");
+ assertTrue(Utils.isDisconnectionSqlCode("01002"), "01002 should be recognised as a disconnection SQL code.");
+ assertTrue(Utils.isDisconnectionSqlCode("JZ0C0"), "JZ0C0 should be recognised as a disconnection SQL code.");
+
+ assertFalse(Utils.isDisconnectionSqlCode("INVALID"), "INVALID should not be recognised as a disconnection SQL code.");
+ assertFalse(Utils.isDisconnectionSqlCode("00000"), "00000 should not be recognised as a disconnection SQL code.");
+ }
}
From e31c128999677f3ee19305be03c687435cf064a0 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 19 Aug 2024 13:29:27 -0400
Subject: [PATCH 069/169] Avoid object creation when invoking
isDisconnectionSqlException. #422
---
src/changes/changes.xml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 71037c5435..a90740fa36 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -71,8 +71,9 @@ The type attribute can be add,update,fix,remove.
Fix PMD UnnecessaryFullyQualifiedName in LocalXAConnectionFactory.Fix SpotBugs MC_OVERRIDABLE_METHOD_CALL_IN_READ_OBJECT in PerUserPoolDataSource.Fix SpotBugs MC_OVERRIDABLE_METHOD_CALL_IN_READ_OBJECT in SharedPoolDataSource.
+ Avoid object creation when invoking isDisconnectionSqlException #422.
- Add support for ignoring non-fatal SQL state codes #421.
+ Add support for ignoring non-fatal SQL state codes #421.Bump org.apache.commons:commons-parent from 66 to 73 #360, #371, #395, #420.Bump commons-logging:commons-logging from 1.3.0 to 1.3.4 #368, #399, #423.
From aa04de7af36bfc8fad52a426ba7723e0793e6298 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 19 Aug 2024 13:29:53 -0400
Subject: [PATCH 070/169] Sort members
---
.../java/org/apache/commons/dbcp2/Utils.java | 22 +++++++++----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/Utils.java b/src/main/java/org/apache/commons/dbcp2/Utils.java
index e9324adb6b..f67f2b60b9 100644
--- a/src/main/java/org/apache/commons/dbcp2/Utils.java
+++ b/src/main/java/org/apache/commons/dbcp2/Utils.java
@@ -216,17 +216,6 @@ public static Set getDisconnectionSqlCodes() {
return new HashSet<>(DISCONNECTION_SQL_CODES);
}
- /**
- * Checks if the given SQL state corresponds to a fatal connection error.
- *
- * @param sqlState the SQL state to check.
- * @return true if the SQL state is a fatal connection error, false otherwise.
- * @since 2.13.0
- */
- static boolean isDisconnectionSqlCode(String sqlState) {
- return DISCONNECTION_SQL_CODES.contains(sqlState);
- }
-
/**
* Gets the correct i18n message for the given key.
*
@@ -253,6 +242,17 @@ public static String getMessage(final String key, final Object... args) {
return mf.format(args, new StringBuffer(), null).toString();
}
+ /**
+ * Checks if the given SQL state corresponds to a fatal connection error.
+ *
+ * @param sqlState the SQL state to check.
+ * @return true if the SQL state is a fatal connection error, false otherwise.
+ * @since 2.13.0
+ */
+ static boolean isDisconnectionSqlCode(String sqlState) {
+ return DISCONNECTION_SQL_CODES.contains(sqlState);
+ }
+
static boolean isEmpty(final Collection> collection) {
return collection == null || collection.isEmpty();
}
From 94736302cebadfcf7fd4ef621a9d6ffba4e40cc2 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 19 Aug 2024 13:31:17 -0400
Subject: [PATCH 071/169] Sort imports
---
src/test/java/org/apache/commons/dbcp2/TestUtils.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/test/java/org/apache/commons/dbcp2/TestUtils.java b/src/test/java/org/apache/commons/dbcp2/TestUtils.java
index 395d25b26b..0d0b157328 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestUtils.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestUtils.java
@@ -23,13 +23,13 @@
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.jupiter.api.Test;
-
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
+import org.junit.jupiter.api.Test;
+
public class TestUtils {
public static PStmtKey getPStmtKey(final PoolablePreparedStatement poolablePreparedStatement) {
From 088e4a7197811bd310d513b71ccf3cf83ba09a7c Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 19 Aug 2024 13:32:58 -0400
Subject: [PATCH 072/169] Use final
Remove trailing whitespace
---
.../org/apache/commons/dbcp2/PoolableConnectionFactory.java | 2 +-
src/main/java/org/apache/commons/dbcp2/Utils.java | 2 +-
src/test/java/org/apache/commons/dbcp2/TesterDriver.java | 2 +-
.../apache/commons/dbcp2/cpdsadapter/TestDriverAdapterCPDS.java | 2 +-
.../commons/dbcp2/datasources/TestPerUserPoolDataSource.java | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java b/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java
index c2f12d2e5a..c182d17421 100644
--- a/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java
+++ b/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java
@@ -628,7 +628,7 @@ public void setDefaultTransactionIsolation(final int defaultTransactionIsolation
* @throws IllegalArgumentException if any SQL state codes overlap with those in {@link #disconnectionSqlCodes}.
* @since 2.13.0
*/
- public void setDisconnectionIgnoreSqlCodes(Collection disconnectionIgnoreSqlCodes) {
+ public void setDisconnectionIgnoreSqlCodes(final Collection disconnectionIgnoreSqlCodes) {
Utils.checkSqlCodes(disconnectionIgnoreSqlCodes, this.disconnectionSqlCodes);
this.disconnectionIgnoreSqlCodes = disconnectionIgnoreSqlCodes;
}
diff --git a/src/main/java/org/apache/commons/dbcp2/Utils.java b/src/main/java/org/apache/commons/dbcp2/Utils.java
index f67f2b60b9..7e3e7c7af0 100644
--- a/src/main/java/org/apache/commons/dbcp2/Utils.java
+++ b/src/main/java/org/apache/commons/dbcp2/Utils.java
@@ -249,7 +249,7 @@ public static String getMessage(final String key, final Object... args) {
* @return true if the SQL state is a fatal connection error, false otherwise.
* @since 2.13.0
*/
- static boolean isDisconnectionSqlCode(String sqlState) {
+ static boolean isDisconnectionSqlCode(final String sqlState) {
return DISCONNECTION_SQL_CODES.contains(sqlState);
}
diff --git a/src/test/java/org/apache/commons/dbcp2/TesterDriver.java b/src/test/java/org/apache/commons/dbcp2/TesterDriver.java
index 5f3c71fab6..38e3d5cf63 100644
--- a/src/test/java/org/apache/commons/dbcp2/TesterDriver.java
+++ b/src/test/java/org/apache/commons/dbcp2/TesterDriver.java
@@ -40,7 +40,7 @@
*
*/
public class TesterDriver implements Driver {
-
+
static TesterDriver INSTANCE = new TesterDriver();
private static final Properties validUserPasswords = new Properties();
diff --git a/src/test/java/org/apache/commons/dbcp2/cpdsadapter/TestDriverAdapterCPDS.java b/src/test/java/org/apache/commons/dbcp2/cpdsadapter/TestDriverAdapterCPDS.java
index 737466690d..784eff84b5 100644
--- a/src/test/java/org/apache/commons/dbcp2/cpdsadapter/TestDriverAdapterCPDS.java
+++ b/src/test/java/org/apache/commons/dbcp2/cpdsadapter/TestDriverAdapterCPDS.java
@@ -295,7 +295,7 @@ public void testIncorrectPassword() throws Exception {
assertThrows(SQLException.class, () -> pcds.getPooledConnection("u1", "zlsafjk"), "Able to retrieve connection with incorrect password");
// Use good password
- SQLException e = assertThrows(SQLException.class, () -> pcds.getPooledConnection("u1", "x"), "Able to retrieve connection with incorrect password");
+ final SQLException e = assertThrows(SQLException.class, () -> pcds.getPooledConnection("u1", "x"), "Able to retrieve connection with incorrect password");
assertTrue(e.getMessage().startsWith("x is not the correct password"));
// else the exception was expected
diff --git a/src/test/java/org/apache/commons/dbcp2/datasources/TestPerUserPoolDataSource.java b/src/test/java/org/apache/commons/dbcp2/datasources/TestPerUserPoolDataSource.java
index d74edc9fd8..4d3080edcb 100644
--- a/src/test/java/org/apache/commons/dbcp2/datasources/TestPerUserPoolDataSource.java
+++ b/src/test/java/org/apache/commons/dbcp2/datasources/TestPerUserPoolDataSource.java
@@ -90,7 +90,7 @@ public void tearDown() throws Exception {
((PerUserPoolDataSource) ds).close();
}
- /**
+ /**
* See DBCP-8
*/
@Test
From 936d4d414afeabc1b17b699905bebed7e14f8d0e Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 23 Aug 2024 01:46:41 -0400
Subject: [PATCH 073/169] Bump github/codeql-action from 3.26.2 to 3.26.4
(#424)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.26.2 to 3.26.4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/429e1977040da7a23b6822b13c129cd1ba93dbb2...f0f3afee809481da311ca3a6ff1ff51d81dbeb24)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/codeql-analysis.yml | 6 +++---
.github/workflows/scorecards-analysis.yml | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index e5d7315bb9..4395234391 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -57,7 +57,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
- uses: github/codeql-action/init@429e1977040da7a23b6822b13c129cd1ba93dbb2 # 3.26.2
+ uses: github/codeql-action/init@f0f3afee809481da311ca3a6ff1ff51d81dbeb24 # 3.26.4
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -68,7 +68,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
- uses: github/codeql-action/autobuild@429e1977040da7a23b6822b13c129cd1ba93dbb2 # 3.26.2
+ uses: github/codeql-action/autobuild@f0f3afee809481da311ca3a6ff1ff51d81dbeb24 # 3.26.4
# âšī¸ Command-line programs to run using the OS shell.
# đ https://git.io/JvXDl
@@ -82,4 +82,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@429e1977040da7a23b6822b13c129cd1ba93dbb2 # 3.26.2
+ uses: github/codeql-action/analyze@f0f3afee809481da311ca3a6ff1ff51d81dbeb24 # 3.26.4
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index 5ddf1e85aa..83eee00d0b 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -64,6 +64,6 @@ jobs:
retention-days: 5
- name: "Upload to code-scanning"
- uses: github/codeql-action/upload-sarif@429e1977040da7a23b6822b13c129cd1ba93dbb2 # 3.26.2
+ uses: github/codeql-action/upload-sarif@f0f3afee809481da311ca3a6ff1ff51d81dbeb24 # 3.26.4
with:
sarif_file: results.sarif
From e8cc314273a821410246060426f07818a0e643cc Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Thu, 29 Aug 2024 08:34:03 -0400
Subject: [PATCH 074/169] Bump org.apache.commons:commons-parent from 73 to 74
(#426)
Bumps [org.apache.commons:commons-parent](https://github.com/apache/commons-parent) from 73 to 74.
- [Changelog](https://github.com/apache/commons-parent/blob/master/RELEASE-NOTES.txt)
- [Commits](https://github.com/apache/commons-parent/commits)
---
updated-dependencies:
- dependency-name: org.apache.commons:commons-parent
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 4aea96f66b..b58137846d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
org.apache.commonscommons-parent
- 73
+ 744.0.0commons-dbcp2
From 8774ea52b2093bff4a7e55776b90a141f9faef40 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Thu, 29 Aug 2024 08:34:33 -0400
Subject: [PATCH 075/169] Bump org.apache.commons:commons-parent from 73 to 74
#426
---
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index a90740fa36..c30f5374ef 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -75,7 +75,7 @@ The type attribute can be add,update,fix,remove.
Add support for ignoring non-fatal SQL state codes #421.
- Bump org.apache.commons:commons-parent from 66 to 73 #360, #371, #395, #420.
+ Bump org.apache.commons:commons-parent from 66 to 74 #360, #371, #395, #420, #426.Bump commons-logging:commons-logging from 1.3.0 to 1.3.4 #368, #399, #423.Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.16.0 #404, #412.Bump org.hamcrest:hamcrest from 2.2 to 3.0 #410.
From 200cd6f250ba164fbf86d84d548096053b115f67 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Thu, 29 Aug 2024 17:49:12 -0400
Subject: [PATCH 076/169] Bump org.apache.commons:commons-lang3 from 3.16.0 to
3.17.0 (#427)
Bumps org.apache.commons:commons-lang3 from 3.16.0 to 3.17.0.
---
updated-dependencies:
- dependency-name: org.apache.commons:commons-lang3
dependency-type: direct:development
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index b58137846d..1409b4ae5d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -82,7 +82,7 @@
org.apache.commonscommons-lang3
- 3.16.0
+ 3.17.0test
From 5492859756356b85c5851475813d4bad874e7056 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Thu, 29 Aug 2024 17:49:47 -0400
Subject: [PATCH 077/169] Bump org.apache.commons:commons-lang3 from 3.16.0 to
3.17.0 #427
---
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index c30f5374ef..0cd2f5b691 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -77,7 +77,7 @@ The type attribute can be add,update,fix,remove.
Bump org.apache.commons:commons-parent from 66 to 74 #360, #371, #395, #420, #426.Bump commons-logging:commons-logging from 1.3.0 to 1.3.4 #368, #399, #423.
- Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.16.0 #404, #412.
+ Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.17.0 #404, #412, #427.Bump org.hamcrest:hamcrest from 2.2 to 3.0 #410.Bump org.slf4j:slf4j-simple from 2.0.13 to 2.0.16 #413, #418.
From d5914a1bb4b50e00eab214d857ca5909e006c019 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 30 Aug 2024 01:18:59 -0400
Subject: [PATCH 078/169] Bump github/codeql-action from 3.26.4 to 3.26.6
(#428)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.26.4 to 3.26.6.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/f0f3afee809481da311ca3a6ff1ff51d81dbeb24...4dd16135b69a43b6c8efb853346f8437d92d3c93)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/codeql-analysis.yml | 6 +++---
.github/workflows/scorecards-analysis.yml | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 4395234391..52bccaf748 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -57,7 +57,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
- uses: github/codeql-action/init@f0f3afee809481da311ca3a6ff1ff51d81dbeb24 # 3.26.4
+ uses: github/codeql-action/init@4dd16135b69a43b6c8efb853346f8437d92d3c93 # 3.26.6
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -68,7 +68,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
- uses: github/codeql-action/autobuild@f0f3afee809481da311ca3a6ff1ff51d81dbeb24 # 3.26.4
+ uses: github/codeql-action/autobuild@4dd16135b69a43b6c8efb853346f8437d92d3c93 # 3.26.6
# âšī¸ Command-line programs to run using the OS shell.
# đ https://git.io/JvXDl
@@ -82,4 +82,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@f0f3afee809481da311ca3a6ff1ff51d81dbeb24 # 3.26.4
+ uses: github/codeql-action/analyze@4dd16135b69a43b6c8efb853346f8437d92d3c93 # 3.26.6
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index 83eee00d0b..da2deb7894 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -64,6 +64,6 @@ jobs:
retention-days: 5
- name: "Upload to code-scanning"
- uses: github/codeql-action/upload-sarif@f0f3afee809481da311ca3a6ff1ff51d81dbeb24 # 3.26.4
+ uses: github/codeql-action/upload-sarif@4dd16135b69a43b6c8efb853346f8437d92d3c93 # 3.26.6
with:
sarif_file: results.sarif
From e1960bd6dfb043024b72646b1c5d15b1638286c6 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sun, 1 Sep 2024 18:51:01 -0400
Subject: [PATCH 079/169] Use Assertions.assertInstanceOf()
---
.../java/org/apache/commons/dbcp2/TestBasicDataSource.java | 5 +++--
.../org/apache/commons/dbcp2/TestDelegatingConnection.java | 6 +++---
.../org/apache/commons/dbcp2/TestDelegatingStatement.java | 4 ++--
.../commons/dbcp2/managed/TestSynchronizationOrder.java | 5 +++--
.../commons/dbcp2/managed/TestTransactionContext.java | 4 ++--
5 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java b/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java
index 66c852d1c1..7e72902832 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java
@@ -20,6 +20,7 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
@@ -112,7 +113,7 @@ public void testAccessToUnderlyingConnectionAllowed() throws Exception {
dconn = ((DelegatingConnection>) conn).getInnermostDelegate();
assertNotNull(dconn);
- assertTrue(dconn instanceof TesterConnection);
+ assertInstanceOf(TesterConnection.class, dconn);
}
}
@@ -484,7 +485,7 @@ public void testDriverClassLoader() throws Exception {
try (Connection conn = getConnection()) {
final ClassLoader cl = ds.getDriverClassLoader();
assertNotNull(cl);
- assertTrue(cl instanceof TesterClassLoader);
+ assertInstanceOf(TesterClassLoader.class, cl);
assertTrue(((TesterClassLoader) cl).didLoad(ds.getDriverClassName()));
}
}
diff --git a/src/test/java/org/apache/commons/dbcp2/TestDelegatingConnection.java b/src/test/java/org/apache/commons/dbcp2/TestDelegatingConnection.java
index 3519b171b4..ad712526ee 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestDelegatingConnection.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestDelegatingConnection.java
@@ -205,7 +205,7 @@ public void testPassivateWithResultSetCloseException() {
delegatingConnection.passivate();
Assertions.fail("Expected SQLExceptionList");
} catch (final SQLException e) {
- Assertions.assertTrue(e instanceof SQLExceptionList);
+ Assertions.assertInstanceOf(SQLExceptionList.class, e);
Assertions.assertEquals(1, ((SQLExceptionList) e).getCauseList().size());
} finally {
testerResultSet.setSqlExceptionOnClose(false);
@@ -222,7 +222,7 @@ public void testPassivateWithResultSetCloseExceptionAndStatementCloseException()
delegatingConnection.passivate();
Assertions.fail("Expected SQLExceptionList");
} catch (final SQLException e) {
- Assertions.assertTrue(e instanceof SQLExceptionList);
+ Assertions.assertInstanceOf(SQLExceptionList.class, e);
Assertions.assertEquals(2, ((SQLExceptionList) e).getCauseList().size());
} finally {
testerStatement.setSqlExceptionOnClose(false);
@@ -238,7 +238,7 @@ public void testPassivateWithStatementCloseException() {
delegatingConnection.passivate();
Assertions.fail("Expected SQLExceptionList");
} catch (final SQLException e) {
- Assertions.assertTrue(e instanceof SQLExceptionList);
+ Assertions.assertInstanceOf(SQLExceptionList.class, e);
Assertions.assertEquals(1, ((SQLExceptionList) e).getCauseList().size());
} finally {
testerStatement.setSqlExceptionOnClose(false);
diff --git a/src/test/java/org/apache/commons/dbcp2/TestDelegatingStatement.java b/src/test/java/org/apache/commons/dbcp2/TestDelegatingStatement.java
index 770e379afc..770e8443ca 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestDelegatingStatement.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestDelegatingStatement.java
@@ -142,7 +142,7 @@ public void testCloseWithResultSetCloseException() throws Exception {
delegatingStatement.close();
Assertions.fail("Excpected a SQLExceptionList");
} catch (final SQLException e) {
- Assertions.assertTrue(e instanceof SQLExceptionList);
+ Assertions.assertInstanceOf(SQLExceptionList.class, e);
} finally {
testerResultSet.setSqlExceptionOnClose(false);
}
@@ -156,7 +156,7 @@ public void testCloseWithStatementCloseException() throws Exception {
delegatingTesterStatement.close();
Assertions.fail("Excpected a SQLExceptionList");
} catch (final SQLException e) {
- Assertions.assertTrue(e instanceof SQLExceptionList);
+ Assertions.assertInstanceOf(SQLExceptionList.class, e);
} finally {
testerStatement.setSqlExceptionOnClose(false);
}
diff --git a/src/test/java/org/apache/commons/dbcp2/managed/TestSynchronizationOrder.java b/src/test/java/org/apache/commons/dbcp2/managed/TestSynchronizationOrder.java
index e37f10a943..47cb93eef6 100644
--- a/src/test/java/org/apache/commons/dbcp2/managed/TestSynchronizationOrder.java
+++ b/src/test/java/org/apache/commons/dbcp2/managed/TestSynchronizationOrder.java
@@ -18,6 +18,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more
package org.apache.commons.dbcp2.managed;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.lang.reflect.InvocationHandler;
@@ -187,7 +188,7 @@ public void testInterposedSynchronization() throws Exception {
transactionManager.begin();
try (final Connection connectionA = ds.getConnection()) {
// Check and close right away.
- assertTrue(connectionA instanceof DelegatingConnection);
+ assertInstanceOf(DelegatingConnection.class, connectionA);
}
transactionManager.commit();
assertFalse(transactionManagerRegistered);
@@ -220,7 +221,7 @@ public void testSessionSynchronization() throws Exception {
transactionManager.begin();
try (final Connection connectionA = ds.getConnection()) {
// Check and close right away.
- assertTrue(connectionA instanceof DelegatingConnection);
+ assertInstanceOf(DelegatingConnection.class, connectionA);
}
transactionManager.commit();
assertTrue(transactionManagerRegistered);
diff --git a/src/test/java/org/apache/commons/dbcp2/managed/TestTransactionContext.java b/src/test/java/org/apache/commons/dbcp2/managed/TestTransactionContext.java
index 2c46cd8c38..211cca002e 100644
--- a/src/test/java/org/apache/commons/dbcp2/managed/TestTransactionContext.java
+++ b/src/test/java/org/apache/commons/dbcp2/managed/TestTransactionContext.java
@@ -17,8 +17,8 @@ Licensed to the Apache Software Foundation (ASF) under one or more
*/
package org.apache.commons.dbcp2.managed;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.assertTrue;
import java.sql.Connection;
import java.sql.SQLException;
@@ -62,7 +62,7 @@ public void testSetSharedConnectionEnlistFailure() throws Exception {
basicManagedDataSource.setPassword("password");
basicManagedDataSource.setMaxIdle(1);
try (final Connection conn = basicManagedDataSource.getConnection()) {
- assertTrue(conn instanceof ManagedConnection);
+ assertInstanceOf(ManagedConnection.class, conn);
final UncooperativeTransaction transaction = new UncooperativeTransaction();
final TransactionContext transactionContext = new TransactionContext(basicManagedDataSource.getTransactionRegistry(), transaction);
assertThrows(SQLException.class, () -> transactionContext.setSharedConnection(conn));
From 476048ede93f257d566510cf7021de30ee5eedb9 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Thu, 5 Sep 2024 22:09:04 -0700
Subject: [PATCH 080/169] Bump actions/upload-artifact from 4.3.6 to 4.4.0
(#429)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.3.6 to 4.4.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/834a144ee995460fba8ed112a2fc961b36a5ec5a...50769540e7f4bd5e21e526ee35c689e35e0d6874)
---
updated-dependencies:
- dependency-name: actions/upload-artifact
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/scorecards-analysis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index da2deb7894..c18f0c3f12 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -57,7 +57,7 @@ jobs:
publish_results: true
- name: "Upload artifact"
- uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # 4.3.6
+ uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # 4.4.0
with:
name: SARIF file
path: results.sarif
From 40fc857adb7f4948297ea89473d0686a3a8c3408 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Thu, 12 Sep 2024 08:36:52 -0400
Subject: [PATCH 081/169] Convert cascading if-else to switch
---
.../commons/dbcp2/BasicDataSourceFactory.java | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/BasicDataSourceFactory.java b/src/main/java/org/apache/commons/dbcp2/BasicDataSourceFactory.java
index 84beb588dd..11a154c90a 100644
--- a/src/main/java/org/apache/commons/dbcp2/BasicDataSourceFactory.java
+++ b/src/main/java/org/apache/commons/dbcp2/BasicDataSourceFactory.java
@@ -239,17 +239,23 @@ public static BasicDataSource createDataSource(final Properties properties) thro
getOptional(properties, PROP_DEFAULT_TRANSACTION_ISOLATION).ifPresent(value -> {
value = value.toUpperCase(Locale.ROOT);
int level = PoolableConnectionFactory.UNKNOWN_TRANSACTION_ISOLATION;
- if ("NONE".equals(value)) {
+ switch (value) {
+ case "NONE":
level = Connection.TRANSACTION_NONE;
- } else if ("READ_COMMITTED".equals(value)) {
+ break;
+ case "READ_COMMITTED":
level = Connection.TRANSACTION_READ_COMMITTED;
- } else if ("READ_UNCOMMITTED".equals(value)) {
+ break;
+ case "READ_UNCOMMITTED":
level = Connection.TRANSACTION_READ_UNCOMMITTED;
- } else if ("REPEATABLE_READ".equals(value)) {
+ break;
+ case "REPEATABLE_READ":
level = Connection.TRANSACTION_REPEATABLE_READ;
- } else if ("SERIALIZABLE".equals(value)) {
+ break;
+ case "SERIALIZABLE":
level = Connection.TRANSACTION_SERIALIZABLE;
- } else {
+ break;
+ default:
try {
level = Integer.parseInt(value);
} catch (final NumberFormatException e) {
@@ -258,6 +264,7 @@ public static BasicDataSource createDataSource(final Properties properties) thro
System.err.println("using default value of database driver");
level = PoolableConnectionFactory.UNKNOWN_TRANSACTION_ISOLATION;
}
+ break;
}
dataSource.setDefaultTransactionIsolation(level);
});
From 4ee88ee0da027cd7f5dac64c6157ff60ee56d04e Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Thu, 12 Sep 2024 08:36:57 -0400
Subject: [PATCH 082/169] Convert cascading if-else to switch
---
.../managed/TestDataSourceXAConnectionFactory.java | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/test/java/org/apache/commons/dbcp2/managed/TestDataSourceXAConnectionFactory.java b/src/test/java/org/apache/commons/dbcp2/managed/TestDataSourceXAConnectionFactory.java
index 6646bb13fc..870876589a 100644
--- a/src/test/java/org/apache/commons/dbcp2/managed/TestDataSourceXAConnectionFactory.java
+++ b/src/test/java/org/apache/commons/dbcp2/managed/TestDataSourceXAConnectionFactory.java
@@ -55,15 +55,16 @@ protected XAConnection getXAConnection() throws SQLException {
public Object invoke(final Object proxy, final Method method, final Object[] args)
throws Throwable {
final String methodName = method.getName();
- if (methodName.equals("hashCode")) {
+ switch (methodName) {
+ case "hashCode":
return System.identityHashCode(proxy);
- }
- if (methodName.equals("equals")) {
+ case "equals":
return proxy == args[0];
- }
- if (methodName.equals("getXAConnection")) {
+ case "getXAConnection":
// both zero and 2-arg signatures
return getXAConnection();
+ default:
+ break;
}
try {
return method.invoke(ds, args);
From 010b028376bb576fd52f074b2c78a7de78b2e643 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Thu, 12 Sep 2024 08:37:02 -0400
Subject: [PATCH 083/169] Convert cascading if-else to switch
---
.../dbcp2/managed/TesterBasicXAConnection.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/test/java/org/apache/commons/dbcp2/managed/TesterBasicXAConnection.java b/src/test/java/org/apache/commons/dbcp2/managed/TesterBasicXAConnection.java
index 9d36c93c25..b5994ef594 100644
--- a/src/test/java/org/apache/commons/dbcp2/managed/TesterBasicXAConnection.java
+++ b/src/test/java/org/apache/commons/dbcp2/managed/TesterBasicXAConnection.java
@@ -75,17 +75,17 @@ public void closeHandle() {
public Object invoke(final Object proxy, final Method method, final Object[] args)
throws Throwable {
final String methodName = method.getName();
- if (methodName.equals("hashCode")) {
+ switch (methodName) {
+ case "hashCode":
return System.identityHashCode(proxy);
- }
- if (methodName.equals("equals")) {
+ case "equals":
return proxy == args[0];
- }
- if (methodName.equals("isClosed")) {
+ case "isClosed":
return conn == null;
- }
- if (methodName.equals("close")) {
+ case "close":
return close();
+ default:
+ break;
}
if (conn == null) {
throw new SQLException("Connection closed");
From 1743fdd9f0f2a5a4d13b84c42c49803d22e4d810 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Thu, 12 Sep 2024 08:37:06 -0400
Subject: [PATCH 084/169] Convert cascading if-else to switch
---
.../org/apache/commons/dbcp2/TesterConnection.java | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/test/java/org/apache/commons/dbcp2/TesterConnection.java b/src/test/java/org/apache/commons/dbcp2/TesterConnection.java
index 3e6e4bb4e6..449801719c 100644
--- a/src/test/java/org/apache/commons/dbcp2/TesterConnection.java
+++ b/src/test/java/org/apache/commons/dbcp2/TesterConnection.java
@@ -282,14 +282,15 @@ public CallableStatement prepareCall(final String sql, final int resultSetType,
@Override
public PreparedStatement prepareStatement(final String sql) throws SQLException {
checkOpen();
- if ("null".equals(sql)) {
+ switch (sql) {
+ case "null":
return null;
- }
- if ("invalid".equals(sql)) {
+ case "invalid":
throw new SQLException("invalid query");
- }
- if ("broken".equals(sql)) {
+ case "broken":
throw new SQLException("broken connection");
+ default:
+ break;
}
return new TesterPreparedStatement(this, sql);
}
From 78eca7e16d8d16669dd28b6da03cea997b61c657 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Thu, 12 Sep 2024 08:37:09 -0400
Subject: [PATCH 085/169] Convert cascading if-else to switch
---
.../org/apache/commons/dbcp2/TesterStatement.java | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/test/java/org/apache/commons/dbcp2/TesterStatement.java b/src/test/java/org/apache/commons/dbcp2/TesterStatement.java
index 0b6479c8fb..764372693d 100644
--- a/src/test/java/org/apache/commons/dbcp2/TesterStatement.java
+++ b/src/test/java/org/apache/commons/dbcp2/TesterStatement.java
@@ -175,20 +175,21 @@ public long executeLargeUpdate(final String sql, final String[] columnNames) thr
@Override
public ResultSet executeQuery(final String sql) throws SQLException {
checkOpen();
- if ("null".equals(sql)) {
+ switch (sql) {
+ case "null":
return null;
- }
- if ("invalid".equals(sql)) {
+ case "invalid":
throw new SQLException("invalid query");
- }
- if ("broken".equals(sql)) {
+ case "broken":
throw new SQLException("broken connection");
- }
- if ("select username".equals(sql)) {
+ case "select username": {
final String userName = ((TesterConnection) connection).getUserName();
final Object[][] data = { { userName } };
return new TesterResultSet(this, data);
}
+ default:
+ break;
+ }
// Simulate timeout if queryTimout is set to less than 5 seconds
if (queryTimeout > 0 && queryTimeout < 5) {
throw new SQLException("query timeout");
From 6d1153f0d5b5307f026a414bf443b3fc40ac2af5 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Thu, 12 Sep 2024 08:41:29 -0400
Subject: [PATCH 086/169] Convert cascading if-else to switch
---
.../dbcp2/managed/TestSynchronizationOrder.java | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/test/java/org/apache/commons/dbcp2/managed/TestSynchronizationOrder.java b/src/test/java/org/apache/commons/dbcp2/managed/TestSynchronizationOrder.java
index 47cb93eef6..81ba125689 100644
--- a/src/test/java/org/apache/commons/dbcp2/managed/TestSynchronizationOrder.java
+++ b/src/test/java/org/apache/commons/dbcp2/managed/TestSynchronizationOrder.java
@@ -134,15 +134,16 @@ protected XAConnection getXAConnection() throws SQLException {
public Object invoke(final Object proxy, final Method method, final Object[] args)
throws Throwable {
final String methodName = method.getName();
- if (methodName.equals("hashCode")) {
+ switch (methodName) {
+ case "hashCode":
return System.identityHashCode(proxy);
- }
- if (methodName.equals("equals")) {
+ case "equals":
return proxy == args[0];
- }
- if (methodName.equals("getXAConnection")) {
+ case "getXAConnection":
// both zero and 2-arg signatures
return getXAConnection();
+ default:
+ break;
}
try {
return method.invoke(bds, args);
From d90918027f353ab8db3839c64a095c93ef859576 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 13 Sep 2024 02:51:50 -0400
Subject: [PATCH 087/169] Bump actions/setup-java from 4.2.2 to 4.3.0 (#431)
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 4.2.2 to 4.3.0.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](https://github.com/actions/setup-java/compare/6a0805fcefea3d4657a47ac4c165951e33482018...2dfa2011c5b2a0f1489bf9e433881c92c1631f88)
---
updated-dependencies:
- dependency-name: actions/setup-java
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/maven.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 822b7994d4..64be3c59af 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -46,7 +46,7 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK ${{ matrix.java }}
- uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
+ uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4.3.0
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
From 5cafbb3c5fc8c1e20b0b693130830dc8c2ee7c35 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Wed, 18 Sep 2024 20:33:54 -0400
Subject: [PATCH 088/169] CI builds: Replace Java 22 with Java 23
---
.github/workflows/maven.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 64be3c59af..0f957feca3 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -27,10 +27,10 @@ jobs:
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
- java: [ 8, 11, 17, 21, 22 ]
+ java: [ 8, 11, 17, 21 ]
experimental: [false]
include:
- - java: 23-ea
+ - java: 23
experimental: true
- java: 24-ea
experimental: true
From 09f7209c5080270bcfef90685b12135e73f8e111 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 20 Sep 2024 01:07:50 -0400
Subject: [PATCH 089/169] Bump github/codeql-action from 3.26.6 to 3.26.8
(#433)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.26.6 to 3.26.8.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/4dd16135b69a43b6c8efb853346f8437d92d3c93...294a9d92911152fe08befb9ec03e240add280cb3)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/codeql-analysis.yml | 6 +++---
.github/workflows/scorecards-analysis.yml | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 52bccaf748..cb162be7d4 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -57,7 +57,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
- uses: github/codeql-action/init@4dd16135b69a43b6c8efb853346f8437d92d3c93 # 3.26.6
+ uses: github/codeql-action/init@294a9d92911152fe08befb9ec03e240add280cb3 # 3.26.8
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -68,7 +68,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
- uses: github/codeql-action/autobuild@4dd16135b69a43b6c8efb853346f8437d92d3c93 # 3.26.6
+ uses: github/codeql-action/autobuild@294a9d92911152fe08befb9ec03e240add280cb3 # 3.26.8
# âšī¸ Command-line programs to run using the OS shell.
# đ https://git.io/JvXDl
@@ -82,4 +82,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@4dd16135b69a43b6c8efb853346f8437d92d3c93 # 3.26.6
+ uses: github/codeql-action/analyze@294a9d92911152fe08befb9ec03e240add280cb3 # 3.26.8
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index c18f0c3f12..f80c265c40 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -64,6 +64,6 @@ jobs:
retention-days: 5
- name: "Upload to code-scanning"
- uses: github/codeql-action/upload-sarif@4dd16135b69a43b6c8efb853346f8437d92d3c93 # 3.26.6
+ uses: github/codeql-action/upload-sarif@294a9d92911152fe08befb9ec03e240add280cb3 # 3.26.8
with:
sarif_file: results.sarif
From 007181535220e81f9fe5bc0cd3cc8adaca190c9f Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 20 Sep 2024 19:59:17 -0400
Subject: [PATCH 090/169] Add dependency-review.yml to GitHub CI
---
.github/workflows/dependency-review.yml | 31 +++++++++++++++++++++++++
1 file changed, 31 insertions(+)
create mode 100644 .github/workflows/dependency-review.yml
diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml
new file mode 100644
index 0000000000..0748cf09ac
--- /dev/null
+++ b/.github/workflows/dependency-review.yml
@@ -0,0 +1,31 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+name: 'Dependency Review'
+on: [pull_request]
+
+permissions:
+ contents: read
+
+jobs:
+ dependency-review:
+ runs-on: ubuntu-latest
+ steps:
+ - name: 'Checkout Repository'
+ uses: actions/checkout@v4
+ - name: 'Dependency Review'
+ uses: actions/dependency-review-action@v4
From 7d932ac73576bd93873cb05b13ed7139240cca35 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 23 Sep 2024 09:28:33 -0400
Subject: [PATCH 091/169] Also run DR on push
---
.github/workflows/dependency-review.yml | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml
index 0748cf09ac..ae11bd031b 100644
--- a/.github/workflows/dependency-review.yml
+++ b/.github/workflows/dependency-review.yml
@@ -16,7 +16,7 @@
# under the License.
name: 'Dependency Review'
-on: [pull_request]
+on: [push, pull_request]
permissions:
contents: read
@@ -27,5 +27,8 @@ jobs:
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v4
- - name: 'Dependency Review'
- uses: actions/dependency-review-action@v4
+ - name: 'Dependency Review PR'
+ uses: actions/dependency-review-action@v4.3.4
+ with:
+ base-ref: ${{ github.event.before }}
+ head-ref: ${{ github.sha }}
From 295cb3251d7c2239110dacd31ce0a0ba21d842b8 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 27 Sep 2024 04:22:24 -0400
Subject: [PATCH 092/169] Bump github/codeql-action from 3.26.8 to 3.26.9
(#434)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.26.8 to 3.26.9.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/294a9d92911152fe08befb9ec03e240add280cb3...461ef6c76dfe95d5c364de2f431ddbd31a417628)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/codeql-analysis.yml | 6 +++---
.github/workflows/scorecards-analysis.yml | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index cb162be7d4..637f98ab79 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -57,7 +57,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
- uses: github/codeql-action/init@294a9d92911152fe08befb9ec03e240add280cb3 # 3.26.8
+ uses: github/codeql-action/init@461ef6c76dfe95d5c364de2f431ddbd31a417628 # 3.26.9
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -68,7 +68,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
- uses: github/codeql-action/autobuild@294a9d92911152fe08befb9ec03e240add280cb3 # 3.26.8
+ uses: github/codeql-action/autobuild@461ef6c76dfe95d5c364de2f431ddbd31a417628 # 3.26.9
# âšī¸ Command-line programs to run using the OS shell.
# đ https://git.io/JvXDl
@@ -82,4 +82,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@294a9d92911152fe08befb9ec03e240add280cb3 # 3.26.8
+ uses: github/codeql-action/analyze@461ef6c76dfe95d5c364de2f431ddbd31a417628 # 3.26.9
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index f80c265c40..dcf5cbaeff 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -64,6 +64,6 @@ jobs:
retention-days: 5
- name: "Upload to code-scanning"
- uses: github/codeql-action/upload-sarif@294a9d92911152fe08befb9ec03e240add280cb3 # 3.26.8
+ uses: github/codeql-action/upload-sarif@461ef6c76dfe95d5c364de2f431ddbd31a417628 # 3.26.9
with:
sarif_file: results.sarif
From b6955bf4129162d4c1f5eb4ae8dae953a18c273c Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 27 Sep 2024 04:22:41 -0400
Subject: [PATCH 093/169] Bump actions/setup-java from 4.3.0 to 4.4.0 (#435)
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 4.3.0 to 4.4.0.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](https://github.com/actions/setup-java/compare/2dfa2011c5b2a0f1489bf9e433881c92c1631f88...b36c23c0d998641eff861008f374ee103c25ac73)
---
updated-dependencies:
- dependency-name: actions/setup-java
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/maven.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 0f957feca3..b6d422d936 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -46,7 +46,7 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK ${{ matrix.java }}
- uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4.3.0
+ uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4.4.0
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
From 391e51b3f20876db0361e3b16bff2ed5ef51acf7 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 28 Sep 2024 16:20:14 -0400
Subject: [PATCH 094/169] Pin GitHub action versions
---
.github/workflows/dependency-review.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml
index ae11bd031b..173a3f1ac5 100644
--- a/.github/workflows/dependency-review.yml
+++ b/.github/workflows/dependency-review.yml
@@ -26,9 +26,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
- uses: actions/checkout@v4
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: 'Dependency Review PR'
- uses: actions/dependency-review-action@v4.3.4
+ uses: actions/dependency-review-action@5a2ce3f5b92ee19cbb1541a4984c76d921601d7c # v4.3.4
with:
base-ref: ${{ github.event.before }}
head-ref: ${{ github.sha }}
From c519311deaa4cf8a429db7464d54b20109b7af86 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Sat, 28 Sep 2024 20:52:18 -0400
Subject: [PATCH 095/169] Bump org.apache.commons:commons-parent from 74 to 76
(#436)
Bumps [org.apache.commons:commons-parent](https://github.com/apache/commons-parent) from 74 to 76.
- [Changelog](https://github.com/apache/commons-parent/blob/master/RELEASE-NOTES.txt)
- [Commits](https://github.com/apache/commons-parent/commits)
---
updated-dependencies:
- dependency-name: org.apache.commons:commons-parent
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 1409b4ae5d..2eff6db1b4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
org.apache.commonscommons-parent
- 74
+ 764.0.0commons-dbcp2
From 1b1c81d42dd96d08217bee7672f5a00e5eebc38b Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 28 Sep 2024 20:52:56 -0400
Subject: [PATCH 096/169] Bump org.apache.commons:commons-parent from 74 to 76
#436
---
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 0cd2f5b691..802c9f0fd3 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -75,7 +75,7 @@ The type attribute can be add,update,fix,remove.
Add support for ignoring non-fatal SQL state codes #421.
- Bump org.apache.commons:commons-parent from 66 to 74 #360, #371, #395, #420, #426.
+ Bump org.apache.commons:commons-parent from 66 to 76 #360, #371, #395, #420, #426, #436.Bump commons-logging:commons-logging from 1.3.0 to 1.3.4 #368, #399, #423.Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.17.0 #404, #412, #427.Bump org.hamcrest:hamcrest from 2.2 to 3.0 #410.
From 98933fef0bb41372a59ec566b791aa32cc54fb48 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Tue, 1 Oct 2024 10:40:29 -0400
Subject: [PATCH 097/169] Make test more readable and maintainable, and less
verbose
- Use JUnit 5 APIs
- Be consistent throughout tests
---
pom.xml | 14 --------------
.../apache/commons/dbcp2/TestBasicDataSource.java | 5 +----
2 files changed, 1 insertion(+), 18 deletions(-)
diff --git a/pom.xml b/pom.xml
index 2eff6db1b4..fcb72d6319 100644
--- a/pom.xml
+++ b/pom.xml
@@ -59,40 +59,34 @@
commons-pool2${commons.pool.version}
-
commons-loggingcommons-logging1.3.4
-
org.junit.jupiterjunit-jupitertest
-
org.mockitomockito-core4.11.0test
-
org.apache.commonscommons-lang33.17.0test
-
jakarta.transactionjakarta.transaction-api1.3.3
-
tomcat
@@ -100,14 +94,12 @@
5.0.28test
-
tomcatnaming-java5.0.28test
-
org.apache.geronimo.modules
@@ -163,12 +155,6 @@
3.4.3.Finaltest
-
- org.hamcrest
- hamcrest
- 3.0
- test
-
diff --git a/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java b/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java
index 7e72902832..bffe838723 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java
@@ -17,7 +17,6 @@
package org.apache.commons.dbcp2;
-import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
@@ -49,7 +48,6 @@
import javax.management.ObjectName;
import javax.sql.DataSource;
-import org.hamcrest.CoreMatchers;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
@@ -577,8 +575,7 @@ public void testInstanceNotFoundExceptionLogSuppressed() throws Exception {
}
StackMessageLog.clear();
ds.close();
- assertThat(StackMessageLog.popMessage(),
- CoreMatchers.not(CoreMatchers.containsString("InstanceNotFoundException")));
+ assertNull(StackMessageLog.popMessage());
assertNull(ds.getRegisteredJmxName());
}
From 1d71ab447c9c6d01496bcb9a00bdec95f3d8d486 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 4 Oct 2024 05:29:42 -0400
Subject: [PATCH 098/169] Bump actions/checkout from 4.1.7 to 4.2.0 (#438)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.7 to 4.2.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/692973e3d937129bcbf40652eb9f2f61becf3332...d632683dd7b4114ad314bca15554477dd762a938)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/codeql-analysis.yml | 2 +-
.github/workflows/dependency-review.yml | 2 +-
.github/workflows/maven.yml | 2 +-
.github/workflows/scorecards-analysis.yml | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 637f98ab79..467265101f 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -45,7 +45,7 @@ jobs:
steps:
- name: Checkout repository
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
+ uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
persist-credentials: false
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml
index 173a3f1ac5..13f691e212 100644
--- a/.github/workflows/dependency-review.yml
+++ b/.github/workflows/dependency-review.yml
@@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
+ uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: 'Dependency Review PR'
uses: actions/dependency-review-action@5a2ce3f5b92ee19cbb1541a4984c76d921601d7c # v4.3.4
with:
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index b6d422d936..9785b74ed0 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -36,7 +36,7 @@ jobs:
experimental: true
steps:
- - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
+ - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
persist-credentials: false
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index dcf5cbaeff..d837145b6e 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -40,7 +40,7 @@ jobs:
steps:
- name: "Checkout code"
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
+ uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
persist-credentials: false
From 171dd1e271d347e02e8e90689548c1ad1ac6ac9e Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 4 Oct 2024 05:29:56 -0400
Subject: [PATCH 099/169] Bump github/codeql-action from 3.26.9 to 3.26.11
(#439)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.26.9 to 3.26.11.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/461ef6c76dfe95d5c364de2f431ddbd31a417628...6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/codeql-analysis.yml | 6 +++---
.github/workflows/scorecards-analysis.yml | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 467265101f..3ec6f22dff 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -57,7 +57,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
- uses: github/codeql-action/init@461ef6c76dfe95d5c364de2f431ddbd31a417628 # 3.26.9
+ uses: github/codeql-action/init@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # 3.26.11
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -68,7 +68,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
- uses: github/codeql-action/autobuild@461ef6c76dfe95d5c364de2f431ddbd31a417628 # 3.26.9
+ uses: github/codeql-action/autobuild@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # 3.26.11
# âšī¸ Command-line programs to run using the OS shell.
# đ https://git.io/JvXDl
@@ -82,4 +82,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@461ef6c76dfe95d5c364de2f431ddbd31a417628 # 3.26.9
+ uses: github/codeql-action/analyze@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # 3.26.11
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index d837145b6e..7a4b0a5397 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -64,6 +64,6 @@ jobs:
retention-days: 5
- name: "Upload to code-scanning"
- uses: github/codeql-action/upload-sarif@461ef6c76dfe95d5c364de2f431ddbd31a417628 # 3.26.9
+ uses: github/codeql-action/upload-sarif@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # 3.26.11
with:
sarif_file: results.sarif
From de897d5f116d5fda2576921647c428596ff595ab Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sun, 6 Oct 2024 08:44:51 -0400
Subject: [PATCH 100/169] Fix Javadoc on Java 23
---
pom.xml | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index fcb72d6319..825947c054 100644
--- a/pom.xml
+++ b/pom.xml
@@ -240,9 +240,8 @@
${commons.javadoc.version}
- http://docs.oracle.com/javase/8/docs/api
https://commons.apache.org/proper/commons-pool/apidocs
- http://docs.oracle.com/javaee/7/api/
+ ${commons.javadoc.javaee.link}
From 2fc0bbd114a344e4ca24bfc041c1c8d016a77292 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sun, 6 Oct 2024 08:48:43 -0400
Subject: [PATCH 101/169] The Java 23 build is no longer experimental
---
.github/workflows/maven.yml | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 9785b74ed0..61255bc6d1 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -27,11 +27,9 @@ jobs:
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
- java: [ 8, 11, 17, 21 ]
+ java: [ 8, 11, 17, 21, 23 ]
experimental: [false]
include:
- - java: 23
- experimental: true
- java: 24-ea
experimental: true
From 7faad73248c3ae51189e2c0f527545e5880c6733 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Wed, 9 Oct 2024 15:09:30 -0400
Subject: [PATCH 102/169] Bump org.apache.commons:commons-parent from 76 to 77
(#441)
Bumps [org.apache.commons:commons-parent](https://github.com/apache/commons-parent) from 76 to 77.
- [Changelog](https://github.com/apache/commons-parent/blob/master/RELEASE-NOTES.txt)
- [Commits](https://github.com/apache/commons-parent/commits)
---
updated-dependencies:
- dependency-name: org.apache.commons:commons-parent
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 825947c054..d8dbc49122 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
org.apache.commonscommons-parent
- 76
+ 774.0.0commons-dbcp2
From 8df7aca94a32f1caefcd626e2a687239abe84432 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Wed, 9 Oct 2024 15:10:03 -0400
Subject: [PATCH 103/169] Bump org.apache.commons:commons-parent from 76 to 77
#441
---
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 802c9f0fd3..ec1058b14b 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -75,7 +75,7 @@ The type attribute can be add,update,fix,remove.
Add support for ignoring non-fatal SQL state codes #421.
- Bump org.apache.commons:commons-parent from 66 to 76 #360, #371, #395, #420, #426, #436.
+ Bump org.apache.commons:commons-parent from 66 to 77 #360, #371, #395, #420, #426, #436, #441.Bump commons-logging:commons-logging from 1.3.0 to 1.3.4 #368, #399, #423.Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.17.0 #404, #412, #427.Bump org.hamcrest:hamcrest from 2.2 to 3.0 #410.
From 77c21e796215481b2ed0483fb3c5301e290f70c5 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 11 Oct 2024 04:02:41 -0400
Subject: [PATCH 104/169] Bump github/codeql-action from 3.26.11 to 3.26.12
(#442)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.26.11 to 3.26.12.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea...c36620d31ac7c881962c3d9dd939c40ec9434f2b)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/codeql-analysis.yml | 6 +++---
.github/workflows/scorecards-analysis.yml | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 3ec6f22dff..102e2a21ba 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -57,7 +57,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
- uses: github/codeql-action/init@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # 3.26.11
+ uses: github/codeql-action/init@c36620d31ac7c881962c3d9dd939c40ec9434f2b # 3.26.12
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -68,7 +68,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
- uses: github/codeql-action/autobuild@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # 3.26.11
+ uses: github/codeql-action/autobuild@c36620d31ac7c881962c3d9dd939c40ec9434f2b # 3.26.12
# âšī¸ Command-line programs to run using the OS shell.
# đ https://git.io/JvXDl
@@ -82,4 +82,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # 3.26.11
+ uses: github/codeql-action/analyze@c36620d31ac7c881962c3d9dd939c40ec9434f2b # 3.26.12
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index 7a4b0a5397..25e76ae80f 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -64,6 +64,6 @@ jobs:
retention-days: 5
- name: "Upload to code-scanning"
- uses: github/codeql-action/upload-sarif@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # 3.26.11
+ uses: github/codeql-action/upload-sarif@c36620d31ac7c881962c3d9dd939c40ec9434f2b # 3.26.12
with:
sarif_file: results.sarif
From 80ffd54656d7600530b28a2794f89fc87ea94fe0 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 11 Oct 2024 04:02:58 -0400
Subject: [PATCH 105/169] Bump actions/upload-artifact from 4.4.0 to 4.4.3
(#445)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.4.0 to 4.4.3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/50769540e7f4bd5e21e526ee35c689e35e0d6874...b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882)
---
updated-dependencies:
- dependency-name: actions/upload-artifact
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/scorecards-analysis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index 25e76ae80f..a43544c988 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -57,7 +57,7 @@ jobs:
publish_results: true
- name: "Upload artifact"
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # 4.4.0
+ uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # 4.4.3
with:
name: SARIF file
path: results.sarif
From 097b2dc08bb10b58260e58c64406e03d1960fd1e Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 11 Oct 2024 04:03:24 -0400
Subject: [PATCH 106/169] Bump actions/checkout from 4.2.0 to 4.2.1 (#444)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.0 to 4.2.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/d632683dd7b4114ad314bca15554477dd762a938...eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/codeql-analysis.yml | 2 +-
.github/workflows/dependency-review.yml | 2 +-
.github/workflows/maven.yml | 2 +-
.github/workflows/scorecards-analysis.yml | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 102e2a21ba..3fcbbcbd73 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -45,7 +45,7 @@ jobs:
steps:
- name: Checkout repository
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
+ uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
persist-credentials: false
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml
index 13f691e212..21e60b1a96 100644
--- a/.github/workflows/dependency-review.yml
+++ b/.github/workflows/dependency-review.yml
@@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
+ uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: 'Dependency Review PR'
uses: actions/dependency-review-action@5a2ce3f5b92ee19cbb1541a4984c76d921601d7c # v4.3.4
with:
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 61255bc6d1..72fc46d896 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -34,7 +34,7 @@ jobs:
experimental: true
steps:
- - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
+ - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
persist-credentials: false
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index a43544c988..621296f849 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -40,7 +40,7 @@ jobs:
steps:
- name: "Checkout code"
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
+ uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
persist-credentials: false
From 9d805e06b1cba28ff43d731e9fd7b53899dd131e Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 11 Oct 2024 04:03:39 -0400
Subject: [PATCH 107/169] Bump actions/cache from 4.0.2 to 4.1.1 (#443)
Bumps [actions/cache](https://github.com/actions/cache) from 4.0.2 to 4.1.1.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/0c45773b623bea8c8e75f6c82b208c3cf94ea4f9...3624ceb22c1c5a301c8db4169662070a689d9ea8)
---
updated-dependencies:
- dependency-name: actions/cache
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/codeql-analysis.yml | 2 +-
.github/workflows/maven.yml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 3fcbbcbd73..99c1907d45 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -48,7 +48,7 @@ jobs:
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
persist-credentials: false
- - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
+ - uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 72fc46d896..836efc5564 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -37,7 +37,7 @@ jobs:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
persist-credentials: false
- - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
+ - uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
From e995fc7857de3fb85034dc390fcfac198adf2eca Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 14 Oct 2024 07:09:49 -0400
Subject: [PATCH 108/169] Fix GH badge
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index f467f4ec4c..4f40191be5 100644
--- a/README.md
+++ b/README.md
@@ -44,7 +44,7 @@ Apache Commons DBCP
===================
[![Java CI](https://github.com/apache/commons-dbcp/actions/workflows/maven.yml/badge.svg)](https://github.com/apache/commons-dbcp/actions/workflows/maven.yml)
-[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.apache.commons/commons-dbcp2/badge.svg?gav=true)](https://maven-badges.herokuapp.com/maven-central/org.apache.commons/commons-dbcp2/?gav=true)
+[![Maven Central](https://img.shields.io/maven-central/v/org.apache.commons/commons-dbcp2?label=Maven%20Central)](https://search.maven.org/artifact/org.apache.commons/commons-dbcp2)
[![Javadocs](https://javadoc.io/badge/org.apache.commons/commons-dbcp2/2.12.0.svg)](https://javadoc.io/doc/org.apache.commons/commons-dbcp2/2.12.0)
[![CodeQL](https://github.com/apache/commons-dbcp/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/apache/commons-dbcp/actions/workflows/codeql-analysis.yml)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/apache/commons-dbcp/badge)](https://api.securityscorecards.dev/projects/github.com/apache/commons-dbcp)
From f352219966a48b8f01068f34d72c86d8807239a3 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 18 Oct 2024 03:09:00 -0400
Subject: [PATCH 109/169] Bump github/codeql-action from 3.26.12 to 3.26.13
(#446)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.26.12 to 3.26.13.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/c36620d31ac7c881962c3d9dd939c40ec9434f2b...f779452ac5af1c261dce0346a8f964149f49322b)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/codeql-analysis.yml | 6 +++---
.github/workflows/scorecards-analysis.yml | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 99c1907d45..c99ebe62f2 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -57,7 +57,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
- uses: github/codeql-action/init@c36620d31ac7c881962c3d9dd939c40ec9434f2b # 3.26.12
+ uses: github/codeql-action/init@f779452ac5af1c261dce0346a8f964149f49322b # 3.26.13
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -68,7 +68,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
- uses: github/codeql-action/autobuild@c36620d31ac7c881962c3d9dd939c40ec9434f2b # 3.26.12
+ uses: github/codeql-action/autobuild@f779452ac5af1c261dce0346a8f964149f49322b # 3.26.13
# âšī¸ Command-line programs to run using the OS shell.
# đ https://git.io/JvXDl
@@ -82,4 +82,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@c36620d31ac7c881962c3d9dd939c40ec9434f2b # 3.26.12
+ uses: github/codeql-action/analyze@f779452ac5af1c261dce0346a8f964149f49322b # 3.26.13
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index 621296f849..86f966c45f 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -64,6 +64,6 @@ jobs:
retention-days: 5
- name: "Upload to code-scanning"
- uses: github/codeql-action/upload-sarif@c36620d31ac7c881962c3d9dd939c40ec9434f2b # 3.26.12
+ uses: github/codeql-action/upload-sarif@f779452ac5af1c261dce0346a8f964149f49322b # 3.26.13
with:
sarif_file: results.sarif
From 3c438d439e3e00c0ea5f2651b125030e5f80e6e5 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Tue, 22 Oct 2024 10:32:29 -0400
Subject: [PATCH 110/169] Bump org.apache.commons:commons-parent from 77 to 78
(#449)
Bumps [org.apache.commons:commons-parent](https://github.com/apache/commons-parent) from 77 to 78.
- [Changelog](https://github.com/apache/commons-parent/blob/master/RELEASE-NOTES.txt)
- [Commits](https://github.com/apache/commons-parent/commits)
---
updated-dependencies:
- dependency-name: org.apache.commons:commons-parent
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index d8dbc49122..d1fcf22b6c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
org.apache.commonscommons-parent
- 77
+ 784.0.0commons-dbcp2
From 93e27b321097082e2104c5988bd374315937c76d Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Tue, 22 Oct 2024 10:33:00 -0400
Subject: [PATCH 111/169] Bump org.apache.commons:commons-parent from 77 to 78
#449
---
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index ec1058b14b..814d8f6a06 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -75,7 +75,7 @@ The type attribute can be add,update,fix,remove.
Add support for ignoring non-fatal SQL state codes #421.
- Bump org.apache.commons:commons-parent from 66 to 77 #360, #371, #395, #420, #426, #436, #441.
+ Bump org.apache.commons:commons-parent from 66 to 78 #360, #371, #395, #420, #426, #436, #441, #449.Bump commons-logging:commons-logging from 1.3.0 to 1.3.4 #368, #399, #423.Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.17.0 #404, #412, #427.Bump org.hamcrest:hamcrest from 2.2 to 3.0 #410.
From 795cbabeb221564031d38b715381822b04a90eab Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 25 Oct 2024 05:59:23 -0400
Subject: [PATCH 112/169] Bump actions/dependency-review-action from 4.3.4 to
4.3.5 (#450)
Bumps [actions/dependency-review-action](https://github.com/actions/dependency-review-action) from 4.3.4 to 4.3.5.
- [Release notes](https://github.com/actions/dependency-review-action/releases)
- [Commits](https://github.com/actions/dependency-review-action/compare/5a2ce3f5b92ee19cbb1541a4984c76d921601d7c...a6993e2c61fd5dc440b409aa1d6904921c5e1894)
---
updated-dependencies:
- dependency-name: actions/dependency-review-action
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/dependency-review.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml
index 21e60b1a96..c13bd3f92e 100644
--- a/.github/workflows/dependency-review.yml
+++ b/.github/workflows/dependency-review.yml
@@ -28,7 +28,7 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: 'Dependency Review PR'
- uses: actions/dependency-review-action@5a2ce3f5b92ee19cbb1541a4984c76d921601d7c # v4.3.4
+ uses: actions/dependency-review-action@a6993e2c61fd5dc440b409aa1d6904921c5e1894 # v4.3.5
with:
base-ref: ${{ github.event.before }}
head-ref: ${{ github.sha }}
From 4f3820ffa71680b3aad2a9e5a973aee51e0db197 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 25 Oct 2024 05:59:41 -0400
Subject: [PATCH 113/169] Bump actions/cache from 4.1.1 to 4.1.2 (#454)
Bumps [actions/cache](https://github.com/actions/cache) from 4.1.1 to 4.1.2.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/3624ceb22c1c5a301c8db4169662070a689d9ea8...6849a6489940f00c2f30c0fb92c6274307ccb58a)
---
updated-dependencies:
- dependency-name: actions/cache
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/codeql-analysis.yml | 2 +-
.github/workflows/maven.yml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index c99ebe62f2..5e45af8db9 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -48,7 +48,7 @@ jobs:
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
persist-credentials: false
- - uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
+ - uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 836efc5564..5dfd4c3276 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -37,7 +37,7 @@ jobs:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
persist-credentials: false
- - uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
+ - uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
From 52e032cada5b51910f3bb9632ce94e019853ede2 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 25 Oct 2024 05:59:53 -0400
Subject: [PATCH 114/169] Bump actions/setup-java from 4.4.0 to 4.5.0 (#453)
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 4.4.0 to 4.5.0.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](https://github.com/actions/setup-java/compare/b36c23c0d998641eff861008f374ee103c25ac73...8df1039502a15bceb9433410b1a100fbe190c53b)
---
updated-dependencies:
- dependency-name: actions/setup-java
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/maven.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 5dfd4c3276..57e5cea96d 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -44,7 +44,7 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK ${{ matrix.java }}
- uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4.4.0
+ uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
From a45209f87bbbdfbc2925e21101f885a5ce97b709 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 25 Oct 2024 06:00:07 -0400
Subject: [PATCH 115/169] Bump github/codeql-action from 3.26.13 to 3.27.0
(#452)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.26.13 to 3.27.0.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/f779452ac5af1c261dce0346a8f964149f49322b...662472033e021d55d94146f66f6058822b0b39fd)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/codeql-analysis.yml | 6 +++---
.github/workflows/scorecards-analysis.yml | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 5e45af8db9..d5d9fd7900 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -57,7 +57,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
- uses: github/codeql-action/init@f779452ac5af1c261dce0346a8f964149f49322b # 3.26.13
+ uses: github/codeql-action/init@662472033e021d55d94146f66f6058822b0b39fd # 3.27.0
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -68,7 +68,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
- uses: github/codeql-action/autobuild@f779452ac5af1c261dce0346a8f964149f49322b # 3.26.13
+ uses: github/codeql-action/autobuild@662472033e021d55d94146f66f6058822b0b39fd # 3.27.0
# âšī¸ Command-line programs to run using the OS shell.
# đ https://git.io/JvXDl
@@ -82,4 +82,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@f779452ac5af1c261dce0346a8f964149f49322b # 3.26.13
+ uses: github/codeql-action/analyze@662472033e021d55d94146f66f6058822b0b39fd # 3.27.0
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index 86f966c45f..cccd14dc95 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -64,6 +64,6 @@ jobs:
retention-days: 5
- name: "Upload to code-scanning"
- uses: github/codeql-action/upload-sarif@f779452ac5af1c261dce0346a8f964149f49322b # 3.26.13
+ uses: github/codeql-action/upload-sarif@662472033e021d55d94146f66f6058822b0b39fd # 3.27.0
with:
sarif_file: results.sarif
From 2859c8ea41ce4e505c08877691fe0b7aa0d22ee2 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 25 Oct 2024 06:02:13 -0400
Subject: [PATCH 116/169] Bump actions/checkout from 4.2.1 to 4.2.2 (#451)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.1 to 4.2.2.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871...11bd71901bbe5b1630ceea73d27597364c9af683)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/codeql-analysis.yml | 2 +-
.github/workflows/dependency-review.yml | 2 +-
.github/workflows/maven.yml | 2 +-
.github/workflows/scorecards-analysis.yml | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index d5d9fd7900..ebb0e32a39 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -45,7 +45,7 @@ jobs:
steps:
- name: Checkout repository
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml
index c13bd3f92e..a932f55dd4 100644
--- a/.github/workflows/dependency-review.yml
+++ b/.github/workflows/dependency-review.yml
@@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: 'Dependency Review PR'
uses: actions/dependency-review-action@a6993e2c61fd5dc440b409aa1d6904921c5e1894 # v4.3.5
with:
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 57e5cea96d..7ef29c773e 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -34,7 +34,7 @@ jobs:
experimental: true
steps:
- - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index cccd14dc95..ac3fdad816 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -40,7 +40,7 @@ jobs:
steps:
- name: "Checkout code"
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
From 0e290f516cef464dfebb38a6ea56855d542aee0a Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 1 Nov 2024 07:31:41 -0400
Subject: [PATCH 117/169] Only run actions/dependency-review-action on
pull_request
---
.github/workflows/dependency-review.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml
index a932f55dd4..47e7d042b7 100644
--- a/.github/workflows/dependency-review.yml
+++ b/.github/workflows/dependency-review.yml
@@ -16,7 +16,7 @@
# under the License.
name: 'Dependency Review'
-on: [push, pull_request]
+on: [pull_request]
permissions:
contents: read
From 21d22b8c92a6bbd47f87dc9b0dbbe6fc64fbce9c Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Sat, 2 Nov 2024 09:07:43 -0400
Subject: [PATCH 118/169] Bump actions/dependency-review-action from 4.3.5 to
4.4.0 (#455)
Bumps [actions/dependency-review-action](https://github.com/actions/dependency-review-action) from 4.3.5 to 4.4.0.
- [Release notes](https://github.com/actions/dependency-review-action/releases)
- [Commits](https://github.com/actions/dependency-review-action/compare/a6993e2c61fd5dc440b409aa1d6904921c5e1894...4081bf99e2866ebe428fc0477b69eb4fcda7220a)
---
updated-dependencies:
- dependency-name: actions/dependency-review-action
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/dependency-review.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml
index 47e7d042b7..154ab43040 100644
--- a/.github/workflows/dependency-review.yml
+++ b/.github/workflows/dependency-review.yml
@@ -28,7 +28,7 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: 'Dependency Review PR'
- uses: actions/dependency-review-action@a6993e2c61fd5dc440b409aa1d6904921c5e1894 # v4.3.5
+ uses: actions/dependency-review-action@4081bf99e2866ebe428fc0477b69eb4fcda7220a # v4.4.0
with:
base-ref: ${{ github.event.before }}
head-ref: ${{ github.sha }}
From 04933534b1df11ed575d83cabb005b29afa3501c Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sun, 3 Nov 2024 14:31:34 -0500
Subject: [PATCH 119/169] PoolableConnectionFactory.destroyObject() method
behaves incorrectly on ABANDONED connection, issue with unhandled
AbstractMethodError
---
src/changes/changes.xml | 1 +
.../org/apache/commons/dbcp2/PoolableConnectionFactory.java | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 814d8f6a06..8ce351cb7d 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -72,6 +72,7 @@ The type attribute can be add,update,fix,remove.
Fix SpotBugs MC_OVERRIDABLE_METHOD_CALL_IN_READ_OBJECT in PerUserPoolDataSource.Fix SpotBugs MC_OVERRIDABLE_METHOD_CALL_IN_READ_OBJECT in SharedPoolDataSource.Avoid object creation when invoking isDisconnectionSqlException #422.
+ PoolableConnectionFactory.destroyObject() method behaves incorrectly on ABANDONED connection, issue with unhandled AbstractMethodError.Add support for ignoring non-fatal SQL state codes #421.
diff --git a/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java b/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java
index c182d17421..3a4f65cd26 100644
--- a/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java
+++ b/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java
@@ -149,7 +149,7 @@ public void destroyObject(final PooledObject p) throws SQLEx
@Override
public void destroyObject(final PooledObject p, final DestroyMode mode) throws SQLException {
if (mode == DestroyMode.ABANDONED) {
- p.getObject().getInnermostDelegate().abort(Runnable::run);
+ Jdbc41Bridge.abort(p.getObject().getInnermostDelegate(), Runnable::run);
} else {
p.getObject().reallyClose();
}
From b85809ee82bfa3204c47e5717732375019545ef2 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 4 Nov 2024 15:52:17 -0500
Subject: [PATCH 120/169] Fix up action types
Add reference to DBCP-599
---
src/changes/changes.xml | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 8ce351cb7d..29373c5dea 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -64,17 +64,17 @@ The type attribute can be add,update,fix,remove.
- Fix PMD UnnecessaryFullyQualifiedName in AbandonedTrace.
- Fix PMD UnnecessaryFullyQualifiedName in PoolableCallableStatement.
- Fix PMD UnnecessaryFullyQualifiedName in PoolablePreparedStatement.
- Fix PMD UnnecessaryFullyQualifiedName in Utils.
- Fix PMD UnnecessaryFullyQualifiedName in LocalXAConnectionFactory.
- Fix SpotBugs MC_OVERRIDABLE_METHOD_CALL_IN_READ_OBJECT in PerUserPoolDataSource.
- Fix SpotBugs MC_OVERRIDABLE_METHOD_CALL_IN_READ_OBJECT in SharedPoolDataSource.
- Avoid object creation when invoking isDisconnectionSqlException #422.
- PoolableConnectionFactory.destroyObject() method behaves incorrectly on ABANDONED connection, issue with unhandled AbstractMethodError.
+ Fix PMD UnnecessaryFullyQualifiedName in AbandonedTrace.
+ Fix PMD UnnecessaryFullyQualifiedName in PoolableCallableStatement.
+ Fix PMD UnnecessaryFullyQualifiedName in PoolablePreparedStatement.
+ Fix PMD UnnecessaryFullyQualifiedName in Utils.
+ Fix PMD UnnecessaryFullyQualifiedName in LocalXAConnectionFactory.
+ Fix SpotBugs MC_OVERRIDABLE_METHOD_CALL_IN_READ_OBJECT in PerUserPoolDataSource.
+ Fix SpotBugs MC_OVERRIDABLE_METHOD_CALL_IN_READ_OBJECT in SharedPoolDataSource.
+ Avoid object creation when invoking isDisconnectionSqlException #422.
+ PoolableConnectionFactory.destroyObject() method behaves incorrectly on ABANDONED connection, issue with unhandled AbstractMethodError.
- Add support for ignoring non-fatal SQL state codes #421.
+ Add support for ignoring non-fatal SQL state codes #421.Bump org.apache.commons:commons-parent from 66 to 78 #360, #371, #395, #420, #426, #436, #441, #449.Bump commons-logging:commons-logging from 1.3.0 to 1.3.4 #368, #399, #423.
From 65fe477e09dd1d212533be638c4d8379c21de894 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 4 Nov 2024 15:54:22 -0500
Subject: [PATCH 121/169] Remove old code comments
---
src/main/java/org/apache/commons/dbcp2/Utils.java | 7 -------
1 file changed, 7 deletions(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/Utils.java b/src/main/java/org/apache/commons/dbcp2/Utils.java
index 7e3e7c7af0..16f23a2fff 100644
--- a/src/main/java/org/apache/commons/dbcp2/Utils.java
+++ b/src/main/java/org/apache/commons/dbcp2/Utils.java
@@ -94,13 +94,6 @@ public final class Utils {
* @since 2.13.0
*/
static void checkSqlCodes(final Collection codes1, final Collection codes2) {
-// if (codes1 != null && codes2 != null) {
-// for (String code : codes1) {
-// if (codes2.contains(code)) {
-// throw new IllegalArgumentException(code + " cannot be in both disconnectionSqlCodes and disconnectionIgnoreSqlCodes.");
-// }
-// }
-// }
if (codes1 != null && codes2 != null) {
final Set test = new HashSet<>(codes1);
test.retainAll(codes2);
From f12500a00ebcf741f423ea997afdb3f6d54f2e03 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 4 Nov 2024 16:03:44 -0500
Subject: [PATCH 122/169] DelegatingConnection.setSchema(String) should
delegate to Jdbc41Bridge
---
src/changes/changes.xml | 2 ++
.../java/org/apache/commons/dbcp2/DelegatingConnection.java | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 29373c5dea..32af9da4f8 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -73,6 +73,8 @@ The type attribute can be add,update,fix,remove.
Fix SpotBugs MC_OVERRIDABLE_METHOD_CALL_IN_READ_OBJECT in SharedPoolDataSource.Avoid object creation when invoking isDisconnectionSqlException #422.PoolableConnectionFactory.destroyObject() method behaves incorrectly on ABANDONED connection, issue with unhandled AbstractMethodError.
+ DelegatingConnection.setSchema(String) should delegate to Jdbc41Bridge.
+ DelegatingConnection.setSchema(String) should delegate to Jdbc41Bridge.Add support for ignoring non-fatal SQL state codes #421.
diff --git a/src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java b/src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java
index 9231246a4d..3aec922b23 100644
--- a/src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java
+++ b/src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java
@@ -974,7 +974,7 @@ public void setSchema(final String schema) throws SQLException {
try {
Jdbc41Bridge.setSchema(connection, schema);
if (cacheState) {
- cachedSchema = connection.getSchema();
+ cachedSchema = Jdbc41Bridge.getSchema(connection);
}
} catch (final SQLException e) {
cachedSchema = null;
From 566203def248935fa8a4e6ff18b98205e19bfd02 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 4 Nov 2024 17:07:56 -0500
Subject: [PATCH 123/169] Javadoc
---
src/main/java/org/apache/commons/dbcp2/BasicDataSource.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java b/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
index 963010286d..a06e6dcc68 100644
--- a/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
@@ -1642,10 +1642,10 @@ protected void log(final String message) {
}
/**
- * Logs the given throwable.
- * @param message TODO
- * @param throwable the throwable.
+ * Logs the given message and throwable.
*
+ * @param message value to be log.
+ * @param throwable the throwable.
* @since 2.7.0
*/
protected void log(final String message, final Throwable throwable) {
From a3f8a1a902f18460d18c77070680ec1ecf5d1703 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 4 Nov 2024 17:21:09 -0500
Subject: [PATCH 124/169] Add @FunctionalInterface to
SwallowedExceptionListener
---
src/changes/changes.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 32af9da4f8..a0ce5bafcf 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -77,6 +77,7 @@ The type attribute can be add,update,fix,remove.
DelegatingConnection.setSchema(String) should delegate to Jdbc41Bridge.Add support for ignoring non-fatal SQL state codes #421.
+ Add @FunctionalInterface to SwallowedExceptionListener.Bump org.apache.commons:commons-parent from 66 to 78 #360, #371, #395, #420, #426, #436, #441, #449.Bump commons-logging:commons-logging from 1.3.0 to 1.3.4 #368, #399, #423.
From 2e8eb15a2250d8040806d64eeb55acd368774559 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 4 Nov 2024 17:24:46 -0500
Subject: [PATCH 125/169] Update action description
DelegatingConnection.abort(Executor) should delegate to Jdbc41Bridge
---
src/changes/changes.xml | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index a0ce5bafcf..2c7045c440 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -72,8 +72,7 @@ The type attribute can be add,update,fix,remove.
Fix SpotBugs MC_OVERRIDABLE_METHOD_CALL_IN_READ_OBJECT in PerUserPoolDataSource.Fix SpotBugs MC_OVERRIDABLE_METHOD_CALL_IN_READ_OBJECT in SharedPoolDataSource.Avoid object creation when invoking isDisconnectionSqlException #422.
- PoolableConnectionFactory.destroyObject() method behaves incorrectly on ABANDONED connection, issue with unhandled AbstractMethodError.
- DelegatingConnection.setSchema(String) should delegate to Jdbc41Bridge.
+ PoolableConnectionFactory.destroyObject() method behaves incorrectly on ABANDONED connection, issue with unhandled AbstractMethodError. DelegatingConnection.abort(Executor) should delegate to Jdbc41BridgeDelegatingConnection.setSchema(String) should delegate to Jdbc41Bridge.Add support for ignoring non-fatal SQL state codes #421.
From fab4c7853af8b29d1840cec3ad657295e5dedcdb Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 4 Nov 2024 17:30:02 -0500
Subject: [PATCH 126/169] Javadoc
---
.../commons/dbcp2/managed/TransactionContextListener.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/managed/TransactionContextListener.java b/src/main/java/org/apache/commons/dbcp2/managed/TransactionContextListener.java
index 4ebb7e7133..cc1b34c1c7 100644
--- a/src/main/java/org/apache/commons/dbcp2/managed/TransactionContextListener.java
+++ b/src/main/java/org/apache/commons/dbcp2/managed/TransactionContextListener.java
@@ -22,13 +22,14 @@
* @since 2.0
*/
public interface TransactionContextListener {
+
/**
- * Occurs after the transaction commits or rolls back.
+ * Called after a transaction commits or rolls back.
*
* @param transactionContext
- * the transaction context that completed
+ * the transaction context that completed.
* @param committed
- * true if the transaction committed; false otherwise
+ * true if the transaction committed; false otherwise.
*/
void afterCompletion(TransactionContext transactionContext, boolean committed);
}
From 4582d02e71d4502c2b57535da2a3fa6072de24f0 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 4 Nov 2024 17:31:16 -0500
Subject: [PATCH 127/169] Javadoc
No need for fully-qualifed type names
---
.../apache/commons/dbcp2/managed/XAConnectionFactory.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/managed/XAConnectionFactory.java b/src/main/java/org/apache/commons/dbcp2/managed/XAConnectionFactory.java
index 3421fda810..abef80981a 100644
--- a/src/main/java/org/apache/commons/dbcp2/managed/XAConnectionFactory.java
+++ b/src/main/java/org/apache/commons/dbcp2/managed/XAConnectionFactory.java
@@ -30,16 +30,16 @@
* @since 2.0
*/
public interface XAConnectionFactory extends ConnectionFactory {
+
/**
- * Create a new {@link java.sql.Connection} in an implementation specific fashion.
+ * Creates a new {@link Connection} in an implementation specific fashion.
*
* An implementation can assume that the caller of this will wrap the connection in a proxy that protects access to
* the setAutoCommit, commit and rollback when enrolled in a XA transaction.
*
*
- * @return a new {@link java.sql.Connection}
- * @throws java.sql.SQLException
- * if a database error occurs creating the connection
+ * @return a new {@link Connection}
+ * @throws SQLException if a database error occurs creating the connection
*/
@Override
Connection createConnection() throws SQLException;
From cd773657fd063b071c004edfa86d3bec8b4e2de1 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 4 Nov 2024 17:34:05 -0500
Subject: [PATCH 128/169] Javadoc: Add missing @deprecated description
---
src/main/java/org/apache/commons/dbcp2/BasicDataSource.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java b/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
index a06e6dcc68..491e68b892 100644
--- a/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
@@ -1479,7 +1479,7 @@ public synchronized String getUrl() {
* Gets the JDBC connection {code userName} property.
*
* @return the {code userName} passed to the JDBC driver to establish connections
- * @deprecated
+ * @deprecated Use {@link #getUserName()}.
*/
@Deprecated
@Override
From 2216da5299cfb15026536097ee990ee39e06d460 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 4 Nov 2024 18:00:08 -0500
Subject: [PATCH 129/169] Javadoc: Fix build warnings
---
.../apache/commons/dbcp2/DriverConnectionFactory.java | 10 ++++++++--
.../dbcp2/managed/LocalXAConnectionFactory.java | 7 +++++++
.../commons/dbcp2/managed/ManagedConnection.java | 4 ++++
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/DriverConnectionFactory.java b/src/main/java/org/apache/commons/dbcp2/DriverConnectionFactory.java
index 99b0ddfc52..3f59e2d210 100644
--- a/src/main/java/org/apache/commons/dbcp2/DriverConnectionFactory.java
+++ b/src/main/java/org/apache/commons/dbcp2/DriverConnectionFactory.java
@@ -53,6 +53,8 @@ public Connection createConnection() throws SQLException {
}
/**
+ * Gets the connection String.
+ *
* @return The connection String.
* @since 2.6.0
*/
@@ -61,7 +63,9 @@ public String getConnectionString() {
}
/**
- * @return The Driver.
+ * Gets the JDBC Driver.
+ *
+ * @return The JDBC Driver.
* @since 2.6.0
*/
public Driver getDriver() {
@@ -69,7 +73,9 @@ public Driver getDriver() {
}
/**
- * @return The Properties.
+ * Gets the properties.
+ *
+ * @return The properties.
* @since 2.6.0
*/
public Properties getProperties() {
diff --git a/src/main/java/org/apache/commons/dbcp2/managed/LocalXAConnectionFactory.java b/src/main/java/org/apache/commons/dbcp2/managed/LocalXAConnectionFactory.java
index a4a08b9891..e69b98804f 100644
--- a/src/main/java/org/apache/commons/dbcp2/managed/LocalXAConnectionFactory.java
+++ b/src/main/java/org/apache/commons/dbcp2/managed/LocalXAConnectionFactory.java
@@ -368,6 +368,8 @@ public Connection createConnection() throws SQLException {
}
/**
+ * Gets the connection factory.
+ *
* @return The connection factory.
* @since 2.6.0
*/
@@ -375,6 +377,11 @@ public ConnectionFactory getConnectionFactory() {
return connectionFactory;
}
+ /**
+ * Gets the transaction registry.
+ *
+ * @return The transaction registry.
+ */
@Override
public TransactionRegistry getTransactionRegistry() {
return transactionRegistry;
diff --git a/src/main/java/org/apache/commons/dbcp2/managed/ManagedConnection.java b/src/main/java/org/apache/commons/dbcp2/managed/ManagedConnection.java
index 126a39d2bd..3108dc870f 100644
--- a/src/main/java/org/apache/commons/dbcp2/managed/ManagedConnection.java
+++ b/src/main/java/org/apache/commons/dbcp2/managed/ManagedConnection.java
@@ -148,6 +148,8 @@ public Connection getInnermostDelegate() {
}
/**
+ * Gets the transaction context.
+ *
* @return The transaction context.
* @since 2.6.0
*/
@@ -156,6 +158,8 @@ public TransactionContext getTransactionContext() {
}
/**
+ * Gets the transaction registry.
+ *
* @return The transaction registry.
* @since 2.6.0
*/
From d73cae3b70f5d9c6df5bd8e76b4cc07e82b2248d Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Tue, 5 Nov 2024 07:03:01 -0500
Subject: [PATCH 130/169] Use preferred spelling for "cannot"
---
.../dbcp2/managed/LocalXAConnectionFactory.java | 2 +-
.../commons/dbcp2/managed/ManagedConnection.java | 10 +++++-----
.../dbcp2/managed/TestConnectionWithNarayana.java | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/managed/LocalXAConnectionFactory.java b/src/main/java/org/apache/commons/dbcp2/managed/LocalXAConnectionFactory.java
index e69b98804f..248c5cff44 100644
--- a/src/main/java/org/apache/commons/dbcp2/managed/LocalXAConnectionFactory.java
+++ b/src/main/java/org/apache/commons/dbcp2/managed/LocalXAConnectionFactory.java
@@ -211,7 +211,7 @@ public synchronized int prepare(final Xid xid) {
}
/**
- * Always returns a zero length Xid array. The LocalXAConnectionFactory can not support recovery, so no xids
+ * Always returns a zero length Xid array. The LocalXAConnectionFactory cannot support recovery, so no xids
* will ever be found.
*
* @param flag
diff --git a/src/main/java/org/apache/commons/dbcp2/managed/ManagedConnection.java b/src/main/java/org/apache/commons/dbcp2/managed/ManagedConnection.java
index 3108dc870f..a5a72d1a28 100644
--- a/src/main/java/org/apache/commons/dbcp2/managed/ManagedConnection.java
+++ b/src/main/java/org/apache/commons/dbcp2/managed/ManagedConnection.java
@@ -122,7 +122,7 @@ public void close() throws SQLException {
@Override
public void commit() throws SQLException {
if (transactionContext != null) {
- throw new SQLException("Commit can not be set while enrolled in a transaction");
+ throw new SQLException("Commit cannot be set while enrolled in a transaction");
}
super.commit();
}
@@ -179,7 +179,7 @@ public boolean isAccessToUnderlyingConnectionAllowed() {
@Override
public void rollback() throws SQLException {
if (transactionContext != null) {
- throw new SQLException("Commit can not be set while enrolled in a transaction");
+ throw new SQLException("Commit cannot be set while enrolled in a transaction");
}
super.rollback();
}
@@ -187,7 +187,7 @@ public void rollback() throws SQLException {
@Override
public void setAutoCommit(final boolean autoCommit) throws SQLException {
if (transactionContext != null) {
- throw new SQLException("Auto-commit can not be set while enrolled in a transaction");
+ throw new SQLException("Auto-commit cannot be set while enrolled in a transaction");
}
super.setAutoCommit(autoCommit);
}
@@ -195,7 +195,7 @@ public void setAutoCommit(final boolean autoCommit) throws SQLException {
@Override
public void setReadOnly(final boolean readOnly) throws SQLException {
if (transactionContext != null) {
- throw new SQLException("Read-only can not be set while enrolled in a transaction");
+ throw new SQLException("Read-only cannot be set while enrolled in a transaction");
}
super.setReadOnly(readOnly);
}
@@ -244,7 +244,7 @@ private void updateTransactionStatus() throws SQLException {
if (transactionContext != null && !transactionContext.isTransactionComplete()) {
if (transactionContext.isActive()) {
if (transactionContext != transactionRegistry.getActiveTransactionContext()) {
- throw new SQLException("Connection can not be used while enlisted in another transaction");
+ throw new SQLException("Connection cannot be used while enlisted in another transaction");
}
return;
}
diff --git a/src/test/java/org/apache/commons/dbcp2/managed/TestConnectionWithNarayana.java b/src/test/java/org/apache/commons/dbcp2/managed/TestConnectionWithNarayana.java
index dcf9c50b08..f560cbd02c 100644
--- a/src/test/java/org/apache/commons/dbcp2/managed/TestConnectionWithNarayana.java
+++ b/src/test/java/org/apache/commons/dbcp2/managed/TestConnectionWithNarayana.java
@@ -119,7 +119,7 @@ public void testConnectionCommitAfterTimeout() throws Exception {
fail("Should not work after timeout");
} catch (final SQLException e) {
// Expected
- Assertions.assertEquals("Commit can not be set while enrolled in a transaction", e.getMessage());
+ Assertions.assertEquals("Commit cannot be set while enrolled in a transaction", e.getMessage());
}
mds.getTransactionManager().rollback();
}
From 20b61408c623828735446f3f08e53d20470202c9 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 8 Nov 2024 07:19:49 -0500
Subject: [PATCH 131/169] Fix dependency-review.yml for PR only
---
.github/workflows/dependency-review.yml | 3 ---
1 file changed, 3 deletions(-)
diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml
index 154ab43040..6da427d50d 100644
--- a/.github/workflows/dependency-review.yml
+++ b/.github/workflows/dependency-review.yml
@@ -29,6 +29,3 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: 'Dependency Review PR'
uses: actions/dependency-review-action@4081bf99e2866ebe428fc0477b69eb4fcda7220a # v4.4.0
- with:
- base-ref: ${{ github.event.before }}
- head-ref: ${{ github.sha }}
From de8f2ed7ce0bc22484ce78618ff365f2c43f24d2 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 15 Nov 2024 07:07:26 -0500
Subject: [PATCH 132/169] Bump github/codeql-action from 3.27.0 to 3.27.4
(#456)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.27.0 to 3.27.4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/662472033e021d55d94146f66f6058822b0b39fd...ea9e4e37992a54ee68a9622e985e60c8e8f12d9f)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/codeql-analysis.yml | 6 +++---
.github/workflows/scorecards-analysis.yml | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index ebb0e32a39..3cbe0b46a7 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -57,7 +57,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
- uses: github/codeql-action/init@662472033e021d55d94146f66f6058822b0b39fd # 3.27.0
+ uses: github/codeql-action/init@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # 3.27.4
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -68,7 +68,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
- uses: github/codeql-action/autobuild@662472033e021d55d94146f66f6058822b0b39fd # 3.27.0
+ uses: github/codeql-action/autobuild@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # 3.27.4
# âšī¸ Command-line programs to run using the OS shell.
# đ https://git.io/JvXDl
@@ -82,4 +82,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@662472033e021d55d94146f66f6058822b0b39fd # 3.27.0
+ uses: github/codeql-action/analyze@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # 3.27.4
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index ac3fdad816..3aaf39bc3e 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -64,6 +64,6 @@ jobs:
retention-days: 5
- name: "Upload to code-scanning"
- uses: github/codeql-action/upload-sarif@662472033e021d55d94146f66f6058822b0b39fd # 3.27.0
+ uses: github/codeql-action/upload-sarif@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # 3.27.4
with:
sarif_file: results.sarif
From 5f7ff5ac952d6811dc7bcaaf6042be076aff5951 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 15 Nov 2024 11:12:36 -0500
Subject: [PATCH 133/169] Javadoc: Use semantic tag instead of style
tag
---
src/main/java/org/apache/commons/dbcp2/package-info.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/package-info.java b/src/main/java/org/apache/commons/dbcp2/package-info.java
index 7fbc736a5d..61d0e38c28 100644
--- a/src/main/java/org/apache/commons/dbcp2/package-info.java
+++ b/src/main/java/org/apache/commons/dbcp2/package-info.java
@@ -19,7 +19,7 @@
*
* Database Connection Pool API.
*
- * Overview in Dialog Form
+ * Overview in Dialog Form
*
* Q: How do I use the DBCP package?
*
From cf7e602b798836841e1039138bbd0d8bec0f64f1 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Thu, 21 Nov 2024 14:36:41 -0500
Subject: [PATCH 134/169] Add support for ignoring non-fatal SQL state codes
- BasicDataSource.setDisconnectionIgnoreSqlCodes(Collection)
- Return a set with predictable iteration order
---
src/main/java/org/apache/commons/dbcp2/BasicDataSource.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java b/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
index 491e68b892..bf95236418 100644
--- a/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
@@ -30,6 +30,7 @@
import java.time.Duration;
import java.util.Collection;
import java.util.Collections;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Objects;
import java.util.Properties;
@@ -2004,7 +2005,7 @@ public void setDefaultTransactionIsolation(final int defaultTransactionIsolation
public void setDisconnectionIgnoreSqlCodes(final Collection disconnectionIgnoreSqlCodes) {
Utils.checkSqlCodes(disconnectionIgnoreSqlCodes, this.disconnectionSqlCodes);
final Set collect = Utils.isEmpty(disconnectionIgnoreSqlCodes) ? null
- : disconnectionIgnoreSqlCodes.stream().filter(s -> !isEmpty(s)).collect(Collectors.toSet());
+ : disconnectionIgnoreSqlCodes.stream().filter(s -> !isEmpty(s)).collect(Collectors.toCollection(LinkedHashSet::new));
this.disconnectionIgnoreSqlCodes = Utils.isEmpty(collect) ? null : collect;
}
From 4e780c7e96a1679a8fdef5490b1d62cd673071e5 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Thu, 21 Nov 2024 15:10:05 -0500
Subject: [PATCH 135/169] Return a set with predictable iteration order from
BasicDataSource.setDisconnectionSqlCodes(Collection)
---
.../java/org/apache/commons/dbcp2/BasicDataSource.java | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java b/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
index bf95236418..259835df2f 100644
--- a/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
@@ -37,6 +37,7 @@
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.logging.Logger;
+import java.util.stream.Collector;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -2005,7 +2006,7 @@ public void setDefaultTransactionIsolation(final int defaultTransactionIsolation
public void setDisconnectionIgnoreSqlCodes(final Collection disconnectionIgnoreSqlCodes) {
Utils.checkSqlCodes(disconnectionIgnoreSqlCodes, this.disconnectionSqlCodes);
final Set collect = Utils.isEmpty(disconnectionIgnoreSqlCodes) ? null
- : disconnectionIgnoreSqlCodes.stream().filter(s -> !isEmpty(s)).collect(Collectors.toCollection(LinkedHashSet::new));
+ : disconnectionIgnoreSqlCodes.stream().filter(s -> !isEmpty(s)).collect(toLinkedHashSet());
this.disconnectionIgnoreSqlCodes = Utils.isEmpty(collect) ? null : collect;
}
@@ -2034,7 +2035,7 @@ public void setDisconnectionIgnoreSqlCodes(final Collection disconnectio
public void setDisconnectionSqlCodes(final Collection disconnectionSqlCodes) {
Utils.checkSqlCodes(disconnectionSqlCodes, this.disconnectionIgnoreSqlCodes);
final Set collect = Utils.isEmpty(disconnectionSqlCodes) ? null
- : disconnectionSqlCodes.stream().filter(s -> !isEmpty(s)).collect(Collectors.toSet());
+ : disconnectionSqlCodes.stream().filter(s -> !isEmpty(s)).collect(toLinkedHashSet());
this.disconnectionSqlCodes = Utils.isEmpty(collect) ? null : collect;
}
@@ -2653,6 +2654,10 @@ protected void startPoolMaintenance() {
}
}
+ private Collector> toLinkedHashSet() {
+ return Collectors.toCollection(LinkedHashSet::new);
+ }
+
@Override
public T unwrap(final Class iface) throws SQLException {
if (isWrapperFor(iface)) {
From 578d8f100b72f2318f3e27f281dc85c03beb6bbe Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 22 Nov 2024 06:59:30 -0500
Subject: [PATCH 136/169] Bump github/codeql-action from 3.27.4 to 3.27.5
(#457)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.27.4 to 3.27.5.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/ea9e4e37992a54ee68a9622e985e60c8e8f12d9f...f09c1c0a94de965c15400f5634aa42fac8fb8f88)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/codeql-analysis.yml | 6 +++---
.github/workflows/scorecards-analysis.yml | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 3cbe0b46a7..b5db1297e1 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -57,7 +57,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
- uses: github/codeql-action/init@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # 3.27.4
+ uses: github/codeql-action/init@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # 3.27.5
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -68,7 +68,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
- uses: github/codeql-action/autobuild@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # 3.27.4
+ uses: github/codeql-action/autobuild@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # 3.27.5
# âšī¸ Command-line programs to run using the OS shell.
# đ https://git.io/JvXDl
@@ -82,4 +82,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # 3.27.4
+ uses: github/codeql-action/analyze@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # 3.27.5
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index 3aaf39bc3e..94d1bedb66 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -64,6 +64,6 @@ jobs:
retention-days: 5
- name: "Upload to code-scanning"
- uses: github/codeql-action/upload-sarif@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # 3.27.4
+ uses: github/codeql-action/upload-sarif@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # 3.27.5
with:
sarif_file: results.sarif
From 809fc00f2a51da63c4c3e748c4c405b803dacd2f Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 22 Nov 2024 06:59:48 -0500
Subject: [PATCH 137/169] Bump actions/dependency-review-action from 4.4.0 to
4.5.0 (#458)
Bumps [actions/dependency-review-action](https://github.com/actions/dependency-review-action) from 4.4.0 to 4.5.0.
- [Release notes](https://github.com/actions/dependency-review-action/releases)
- [Commits](https://github.com/actions/dependency-review-action/compare/4081bf99e2866ebe428fc0477b69eb4fcda7220a...3b139cfc5fae8b618d3eae3675e383bb1769c019)
---
updated-dependencies:
- dependency-name: actions/dependency-review-action
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/dependency-review.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml
index 6da427d50d..c6ece650e2 100644
--- a/.github/workflows/dependency-review.yml
+++ b/.github/workflows/dependency-review.yml
@@ -28,4 +28,4 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: 'Dependency Review PR'
- uses: actions/dependency-review-action@4081bf99e2866ebe428fc0477b69eb4fcda7220a # v4.4.0
+ uses: actions/dependency-review-action@3b139cfc5fae8b618d3eae3675e383bb1769c019 # v4.5.0
From 8042827978a20732df580eeda00e569817abad94 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 22 Nov 2024 16:16:34 -0500
Subject: [PATCH 138/169] Add missing Javadoc comments and descriptions
---
src/changes/changes.xml | 1 +
.../org/apache/commons/dbcp2/Constants.java | 20 ++++++++-
.../commons/dbcp2/DelegatingConnection.java | 23 ++++++++++
.../dbcp2/DelegatingDatabaseMetaData.java | 6 +++
.../dbcp2/PoolableConnectionFactory.java | 43 ++++++++++++++++---
.../datasources/SharedPoolDataSource.java | 3 --
6 files changed, 86 insertions(+), 10 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 2c7045c440..30c9902279 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -77,6 +77,7 @@ The type attribute can be add,update,fix,remove.
Add support for ignoring non-fatal SQL state codes #421.Add @FunctionalInterface to SwallowedExceptionListener.
+ Add missing Javadoc comments and descriptions.Bump org.apache.commons:commons-parent from 66 to 78 #360, #371, #395, #420, #426, #436, #441, #449.Bump commons-logging:commons-logging from 1.3.0 to 1.3.4 #368, #399, #423.
diff --git a/src/main/java/org/apache/commons/dbcp2/Constants.java b/src/main/java/org/apache/commons/dbcp2/Constants.java
index 26bf3df1a1..7094d62498 100644
--- a/src/main/java/org/apache/commons/dbcp2/Constants.java
+++ b/src/main/java/org/apache/commons/dbcp2/Constants.java
@@ -23,13 +23,29 @@
*/
public class Constants {
+ /**
+ * Constant used to build JMX strings.
+ */
public static final String JMX_CONNECTION_POOL_BASE_EXT = ",connectionpool=";
+
+ /**
+ * Constant used to build JMX strings.
+ */
public static final String JMX_CONNECTION_POOL_PREFIX = "connections";
- public static final String JMX_CONNECTION_BASE_EXT = JMX_CONNECTION_POOL_BASE_EXT + JMX_CONNECTION_POOL_PREFIX
- + ",connection=";
+ /**
+ * Constant used to build JMX strings.
+ */
+ public static final String JMX_CONNECTION_BASE_EXT = JMX_CONNECTION_POOL_BASE_EXT + JMX_CONNECTION_POOL_PREFIX + ",connection=";
+ /**
+ * Constant used to build JMX strings.
+ */
public static final String JMX_STATEMENT_POOL_BASE_EXT = JMX_CONNECTION_BASE_EXT;
+
+ /**
+ * Constant used to build JMX strings.
+ */
public static final String JMX_STATEMENT_POOL_PREFIX = ",statementpool=statements";
/**
diff --git a/src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java b/src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java
index 3aec922b23..4484ac83a8 100644
--- a/src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java
+++ b/src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java
@@ -95,6 +95,9 @@ public void abort(final Executor executor) throws SQLException {
}
}
+ /**
+ * Marks this instance as used and delegates to a wrapped {@link DelegatingConnection#activate()}.
+ */
protected void activate() {
closed = false;
setLastUsed();
@@ -103,6 +106,11 @@ protected void activate() {
}
}
+ /**
+ * Throws a SQLException if this connection is not open.
+ *
+ * @throws SQLException Thrown if this connection is not open.
+ */
protected void checkOpen() throws SQLException {
if (closed) {
if (null != connection) {
@@ -578,6 +586,11 @@ public boolean isClosed() throws SQLException {
return closed || connection == null || connection.isClosed();
}
+ /**
+ * Tests the raw internal closed state.
+ *
+ * @return the raw internal closed state.
+ */
protected boolean isClosedInternal() {
return closed;
}
@@ -649,6 +662,11 @@ public String nativeSQL(final String sql) throws SQLException {
}
}
+ /**
+ * Clears the list of objects being traced by this object.
+ *
+ * @throws SQLException Thrown if not all traced objects were closed.
+ */
protected void passivate() throws SQLException {
// The JDBC specification requires that a Connection close any open
// Statements when it is closed.
@@ -873,6 +891,11 @@ public void setClientInfo(final String name, final String value) throws SQLClien
}
}
+ /**
+ * Sets the raw internal closed state.
+ *
+ * @param closed the raw internal closed state.
+ */
protected void setClosedInternal(final boolean closed) {
this.closed = closed;
}
diff --git a/src/main/java/org/apache/commons/dbcp2/DelegatingDatabaseMetaData.java b/src/main/java/org/apache/commons/dbcp2/DelegatingDatabaseMetaData.java
index ccbc52bbac..f19f3bbbc8 100644
--- a/src/main/java/org/apache/commons/dbcp2/DelegatingDatabaseMetaData.java
+++ b/src/main/java/org/apache/commons/dbcp2/DelegatingDatabaseMetaData.java
@@ -984,6 +984,12 @@ public ResultSet getVersionColumns(final String catalog, final String schema, fi
}
}
+ /**
+ * Delegates to the connection's {@link DelegatingConnection#handleException(SQLException)}.
+ *
+ * @param e the exception to throw or delegate.
+ * @throws SQLException the exception to throw.
+ */
protected void handleException(final SQLException e) throws SQLException {
if (connection == null) {
throw e;
diff --git a/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java b/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java
index 3a4f65cd26..532e857879 100644
--- a/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java
+++ b/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java
@@ -156,7 +156,7 @@ public void destroyObject(final PooledObject p, final Destro
}
/**
- * Gets the cache state.
+ * Gets the cache state to propagate in {@link #makeObject()}.
*
* @return The cache state.
* @since 2.6.0.
@@ -338,14 +338,20 @@ protected int getMaxOpenPreparedStatements() {
public synchronized ObjectPool getPool() {
return pool;
}
+
/**
+ * Tests whether to pool statements.
+ *
* @return Whether to pool statements.
* @since 2.6.0.
*/
public boolean getPoolStatements() {
return poolStatements;
}
+
/**
+ * Gets the validation query.
+ *
* @return Validation query.
* @since 2.6.0
*/
@@ -390,7 +396,9 @@ protected void initializeConnection(final Connection conn) throws SQLException {
}
/**
- * @return Whether to auto-commit on return.
+ * Tests whether to set auto-commit on {@link #passivateObject(PooledObject)}.
+ *
+ * @return Whether to set auto-commit on {@link #passivateObject(PooledObject)}.
* @since 2.6.0
*/
public boolean isAutoCommitOnReturn() {
@@ -398,7 +406,9 @@ public boolean isAutoCommitOnReturn() {
}
/**
- * @return Whether to auto-commit on return.
+ * Tests whether to set auto-commit on {@link #passivateObject(PooledObject)}.
+ *
+ * @return Whether to set auto-commit on {@link #passivateObject(PooledObject)}.
* @deprecated Use {@link #isAutoCommitOnReturn()}.
*/
@Deprecated
@@ -420,6 +430,8 @@ public boolean isFastFailValidation() {
}
/**
+ * Tests whether to rollback on return.
+ *
* @return Whether to rollback on return.
*/
public boolean isRollbackOnReturn() {
@@ -518,10 +530,20 @@ public void passivateObject(final PooledObject p) throws SQL
conn.passivate();
}
+ /**
+ * Sets whether to set auto-commit on {@link #passivateObject(PooledObject)}.
+ *
+ * @param autoCommitOnReturn whether to set auto-commit.
+ */
public void setAutoCommitOnReturn(final boolean autoCommitOnReturn) {
this.autoCommitOnReturn = autoCommitOnReturn;
}
+ /**
+ * Sets the cache state to propagate in {@link #makeObject()}.
+ *
+ * @param cacheState the cache state to propagate.
+ */
public void setCacheState(final boolean cacheState) {
this.cacheState = cacheState;
}
@@ -648,8 +670,9 @@ public void setDisconnectionSqlCodes(final Collection disconnectionSqlCo
}
/**
- * @param autoCommitOnReturn Whether to auto-commit on return.
- * @deprecated Use {@link #setAutoCommitOnReturn(boolean)}.
+ * Sets whether to set auto-commit on {@link #passivateObject(PooledObject)}.
+ *
+ * @param autoCommitOnReturn whether to set auto-commit.
*/
@Deprecated
public void setEnableAutoCommitOnReturn(final boolean autoCommitOnReturn) {
@@ -726,10 +749,20 @@ public synchronized void setPool(final ObjectPool pool) {
this.pool = pool;
}
+ /**
+ * Sets whether to pool statements.
+ *
+ * @param poolStatements whether to pool statements.
+ */
public void setPoolStatements(final boolean poolStatements) {
this.poolStatements = poolStatements;
}
+ /**
+ * Sets whether to rollback on return.
+ *
+ * @param rollbackOnReturn whether to rollback on return.
+ */
public void setRollbackOnReturn(final boolean rollbackOnReturn) {
this.rollbackOnReturn = rollbackOnReturn;
}
diff --git a/src/main/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java b/src/main/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java
index 54e8b8a036..f3e233a108 100644
--- a/src/main/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java
@@ -89,9 +89,6 @@ public int getMaxTotal() {
return this.maxTotal;
}
- // ----------------------------------------------------------------------
- // Instrumentation Methods
-
/**
* Gets the number of active connections in the pool.
*
From 80722a56c914acd20b88eac97398e05c3da832fb Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 22 Nov 2024 16:23:41 -0500
Subject: [PATCH 139/169] Move important fixed to the top
---
src/changes/changes.xml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 30c9902279..7862775b43 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -64,6 +64,9 @@ The type attribute can be add,update,fix,remove.
+ Avoid object creation when invoking isDisconnectionSqlException #422.
+ PoolableConnectionFactory.destroyObject() method behaves incorrectly on ABANDONED connection, issue with unhandled AbstractMethodError. DelegatingConnection.abort(Executor) should delegate to Jdbc41Bridge
+ DelegatingConnection.setSchema(String) should delegate to Jdbc41Bridge.Fix PMD UnnecessaryFullyQualifiedName in AbandonedTrace.Fix PMD UnnecessaryFullyQualifiedName in PoolableCallableStatement.Fix PMD UnnecessaryFullyQualifiedName in PoolablePreparedStatement.
@@ -71,9 +74,6 @@ The type attribute can be add,update,fix,remove.
Fix PMD UnnecessaryFullyQualifiedName in LocalXAConnectionFactory.Fix SpotBugs MC_OVERRIDABLE_METHOD_CALL_IN_READ_OBJECT in PerUserPoolDataSource.Fix SpotBugs MC_OVERRIDABLE_METHOD_CALL_IN_READ_OBJECT in SharedPoolDataSource.
- Avoid object creation when invoking isDisconnectionSqlException #422.
- PoolableConnectionFactory.destroyObject() method behaves incorrectly on ABANDONED connection, issue with unhandled AbstractMethodError. DelegatingConnection.abort(Executor) should delegate to Jdbc41Bridge
- DelegatingConnection.setSchema(String) should delegate to Jdbc41Bridge.Add support for ignoring non-fatal SQL state codes #421.Add @FunctionalInterface to SwallowedExceptionListener.
From 04fcba6aa2b41933f96f9dd7ce05f440ef863578 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 22 Nov 2024 16:28:00 -0500
Subject: [PATCH 140/169] Remove unused package-private constructor
---
.../dbcp2/datasources/PooledConnectionAndInfo.java | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/datasources/PooledConnectionAndInfo.java b/src/main/java/org/apache/commons/dbcp2/datasources/PooledConnectionAndInfo.java
index 04e066dd54..01deb37744 100644
--- a/src/main/java/org/apache/commons/dbcp2/datasources/PooledConnectionAndInfo.java
+++ b/src/main/java/org/apache/commons/dbcp2/datasources/PooledConnectionAndInfo.java
@@ -30,15 +30,6 @@ final class PooledConnectionAndInfo {
private final UserPassKey userPassKey;
- /**
- * Constructs a new instance.
- *
- * @since 2.4.0
- */
- PooledConnectionAndInfo(final PooledConnection pooledConnection, final char[] userName, final char[] userPassword) {
- this(pooledConnection, new UserPassKey(userName, userPassword));
- }
-
PooledConnectionAndInfo(final PooledConnection pooledConnection, final UserPassKey userPassKey) {
this.pooledConnection = pooledConnection;
this.userPassKey = userPassKey;
From 504d5feb41c1a4d29d160d77c021d085680874e9 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 22 Nov 2024 16:28:15 -0500
Subject: [PATCH 141/169] Remove unused package-private constructor
---
.../org/apache/commons/dbcp2/datasources/UserPassKey.java | 4 ----
1 file changed, 4 deletions(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/datasources/UserPassKey.java b/src/main/java/org/apache/commons/dbcp2/datasources/UserPassKey.java
index 94643c8070..cde1bf15dd 100644
--- a/src/main/java/org/apache/commons/dbcp2/datasources/UserPassKey.java
+++ b/src/main/java/org/apache/commons/dbcp2/datasources/UserPassKey.java
@@ -42,10 +42,6 @@ final class UserPassKey implements Serializable {
private final CharArray name;
private final CharArray password;
- UserPassKey(final char[] userName, final char[] password) {
- this(new CharArray(userName), new CharArray(password));
- }
-
UserPassKey(final CharArray userName, final CharArray userPassword) {
this.name = userName;
this.password = userPassword;
From 17fa27397478b7091b93d44569627b9f7bf01845 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 22 Nov 2024 16:38:10 -0500
Subject: [PATCH 142/169] Javadoc
---
.../datasources/KeyedCPDSConnectionFactory.java | 3 +--
.../dbcp2/datasources/SharedPoolDataSource.java | 12 +++++++++++-
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/datasources/KeyedCPDSConnectionFactory.java b/src/main/java/org/apache/commons/dbcp2/datasources/KeyedCPDSConnectionFactory.java
index 3b21c653c7..db7fee5c22 100644
--- a/src/main/java/org/apache/commons/dbcp2/datasources/KeyedCPDSConnectionFactory.java
+++ b/src/main/java/org/apache/commons/dbcp2/datasources/KeyedCPDSConnectionFactory.java
@@ -38,8 +38,7 @@
import org.apache.commons.pool2.impl.DefaultPooledObject;
/**
- * A {@link KeyedPooledObjectFactory} that creates {@link org.apache.commons.dbcp2.PoolableConnection
- * PoolableConnection}s.
+ * A {@link KeyedPooledObjectFactory} that creates {@link PoolableConnection}s.
*
* @since 2.0
*/
diff --git a/src/main/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java b/src/main/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java
index f3e233a108..a30438881e 100644
--- a/src/main/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java
@@ -27,6 +27,7 @@
import javax.sql.ConnectionPoolDataSource;
import org.apache.commons.pool2.KeyedObjectPool;
+import org.apache.commons.pool2.KeyedPooledObjectFactory;
import org.apache.commons.pool2.impl.GenericKeyedObjectPool;
import org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig;
@@ -51,10 +52,19 @@ public class SharedPoolDataSource extends InstanceKeyDataSource {
private static final long serialVersionUID = -1458539734480586454L;
- // Pool properties
+ /**
+ * Max total defaults to {@value}.
+ */
private int maxTotal = GenericKeyedObjectPoolConfig.DEFAULT_MAX_TOTAL;
+ /**
+ * Maps user credentials to pooled connection with credentials.
+ */
private transient KeyedObjectPool pool;
+
+ /**
+ * A {@link KeyedPooledObjectFactory} that creates {@link PoolableConnection}s.
+ */
private transient KeyedCPDSConnectionFactory factory;
/**
From 8dc0e02f5cfa25e1993bf2a8bdb695bda8b0222f Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 22 Nov 2024 16:51:15 -0500
Subject: [PATCH 143/169] Internal refactoring using generics
---
.../datasources/PerUserPoolDataSource.java | 104 +++++-------------
1 file changed, 28 insertions(+), 76 deletions(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSource.java b/src/main/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSource.java
index 46dcf3ae94..8beb6d1507 100644
--- a/src/main/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSource.java
@@ -140,6 +140,16 @@ private Map convertMap(final Map currentMap,
}
+ /**
+ * Gets the user specific default value in a map for the specified user's pool.
+ *
+ * @param userName The user name key.
+ * @return The user specific value.
+ */
+ private V get(final Map map, final String userName) {
+ return map != null ? map.get(userName) : null;
+ }
+
@Override
protected PooledConnectionManager getConnectionManager(final UserPassKey upKey) {
return managers.get(getPoolKey(upKey.getUserName()));
@@ -208,10 +218,7 @@ public int getNumIdle(final String userName) {
* @return The user specific value.
*/
public boolean getPerUserBlockWhenExhausted(final String userName) {
- Boolean value = null;
- if (perUserBlockWhenExhausted != null) {
- value = perUserBlockWhenExhausted.get(userName);
- }
+ final Boolean value = get(perUserBlockWhenExhausted, userName);
if (value == null) {
return getDefaultBlockWhenExhausted();
}
@@ -226,11 +233,7 @@ public boolean getPerUserBlockWhenExhausted(final String userName) {
* @return The user specific value.
*/
public Boolean getPerUserDefaultAutoCommit(final String userName) {
- Boolean value = null;
- if (perUserDefaultAutoCommit != null) {
- value = perUserDefaultAutoCommit.get(userName);
- }
- return value;
+ return get(perUserDefaultAutoCommit, userName);
}
/**
@@ -241,11 +244,7 @@ public Boolean getPerUserDefaultAutoCommit(final String userName) {
* @return The user specific value.
*/
public Boolean getPerUserDefaultReadOnly(final String userName) {
- Boolean value = null;
- if (perUserDefaultReadOnly != null) {
- value = perUserDefaultReadOnly.get(userName);
- }
- return value;
+ return get(perUserDefaultReadOnly, userName);
}
/**
@@ -257,11 +256,7 @@ public Boolean getPerUserDefaultReadOnly(final String userName) {
* @return The user specific value.
*/
public Integer getPerUserDefaultTransactionIsolation(final String userName) {
- Integer value = null;
- if (perUserDefaultTransactionIsolation != null) {
- value = perUserDefaultTransactionIsolation.get(userName);
- }
- return value;
+ return get(perUserDefaultTransactionIsolation, userName);
}
/**
@@ -274,10 +269,7 @@ public Integer getPerUserDefaultTransactionIsolation(final String userName) {
* @since 2.10.0
*/
public Duration getPerUserDurationBetweenEvictionRuns(final String userName) {
- Duration value = null;
- if (perUserDurationBetweenEvictionRuns != null) {
- value = perUserDurationBetweenEvictionRuns.get(userName);
- }
+ final Duration value = get(perUserDurationBetweenEvictionRuns, userName);
if (value == null) {
return getDefaultDurationBetweenEvictionRuns();
}
@@ -293,10 +285,7 @@ public Duration getPerUserDurationBetweenEvictionRuns(final String userName) {
* @return The user specific value.
*/
public String getPerUserEvictionPolicyClassName(final String userName) {
- String value = null;
- if (perUserEvictionPolicyClassName != null) {
- value = perUserEvictionPolicyClassName.get(userName);
- }
+ final String value = get(perUserEvictionPolicyClassName, userName);
if (value == null) {
return getDefaultEvictionPolicyClassName();
}
@@ -312,10 +301,7 @@ public String getPerUserEvictionPolicyClassName(final String userName) {
* @return The user specific value.
*/
public boolean getPerUserLifo(final String userName) {
- Boolean value = null;
- if (perUserLifo != null) {
- value = perUserLifo.get(userName);
- }
+ final Boolean value = get(perUserLifo, userName);
if (value == null) {
return getDefaultLifo();
}
@@ -331,10 +317,7 @@ public boolean getPerUserLifo(final String userName) {
* @return The user specific value.
*/
public int getPerUserMaxIdle(final String userName) {
- Integer value = null;
- if (perUserMaxIdle != null) {
- value = perUserMaxIdle.get(userName);
- }
+ final Integer value = get(perUserMaxIdle, userName);
if (value == null) {
return getDefaultMaxIdle();
}
@@ -350,10 +333,7 @@ public int getPerUserMaxIdle(final String userName) {
* @return The user specific value.
*/
public int getPerUserMaxTotal(final String userName) {
- Integer value = null;
- if (perUserMaxTotal != null) {
- value = perUserMaxTotal.get(userName);
- }
+ final Integer value = get(perUserMaxTotal, userName);
if (value == null) {
return getDefaultMaxTotal();
}
@@ -370,10 +350,7 @@ public int getPerUserMaxTotal(final String userName) {
* @since 2.10.0
*/
public Duration getPerUserMaxWaitDuration(final String userName) {
- Duration value = null;
- if (perUserMaxWaitDuration != null) {
- value = perUserMaxWaitDuration.get(userName);
- }
+ final Duration value = get(perUserMaxWaitDuration, userName);
if (value == null) {
return getDefaultMaxWait();
}
@@ -404,10 +381,7 @@ public long getPerUserMaxWaitMillis(final String userName) {
* @since 2.10.0
*/
public Duration getPerUserMinEvictableIdleDuration(final String userName) {
- Duration value = null;
- if (perUserMinEvictableIdleDuration != null) {
- value = perUserMinEvictableIdleDuration.get(userName);
- }
+ final Duration value = get(perUserMinEvictableIdleDuration, userName);
if (value == null) {
return getDefaultMinEvictableIdleDuration();
}
@@ -437,10 +411,7 @@ public long getPerUserMinEvictableIdleTimeMillis(final String userName) {
* @return The user specific value.
*/
public int getPerUserMinIdle(final String userName) {
- Integer value = null;
- if (perUserMinIdle != null) {
- value = perUserMinIdle.get(userName);
- }
+ final Integer value = get(perUserMinIdle, userName);
if (value == null) {
return getDefaultMinIdle();
}
@@ -456,10 +427,7 @@ public int getPerUserMinIdle(final String userName) {
* @return The user specific value.
*/
public int getPerUserNumTestsPerEvictionRun(final String userName) {
- Integer value = null;
- if (perUserNumTestsPerEvictionRun != null) {
- value = perUserNumTestsPerEvictionRun.get(userName);
- }
+ final Integer value = get(perUserNumTestsPerEvictionRun, userName);
if (value == null) {
return getDefaultNumTestsPerEvictionRun();
}
@@ -476,10 +444,7 @@ public int getPerUserNumTestsPerEvictionRun(final String userName) {
* @since 2.10.0
*/
public Duration getPerUserSoftMinEvictableIdleDuration(final String userName) {
- Duration value = null;
- if (perUserSoftMinEvictableIdleDuration != null) {
- value = perUserSoftMinEvictableIdleDuration.get(userName);
- }
+ final Duration value = get(perUserSoftMinEvictableIdleDuration, userName);
if (value == null) {
return getDefaultSoftMinEvictableIdleDuration();
}
@@ -509,10 +474,7 @@ public long getPerUserSoftMinEvictableIdleTimeMillis(final String userName) {
* @return The user specific value.
*/
public boolean getPerUserTestOnBorrow(final String userName) {
- Boolean value = null;
- if (perUserTestOnBorrow != null) {
- value = perUserTestOnBorrow.get(userName);
- }
+ final Boolean value = get(perUserTestOnBorrow, userName);
if (value == null) {
return getDefaultTestOnBorrow();
}
@@ -528,10 +490,7 @@ public boolean getPerUserTestOnBorrow(final String userName) {
* @return The user specific value.
*/
public boolean getPerUserTestOnCreate(final String userName) {
- Boolean value = null;
- if (perUserTestOnCreate != null) {
- value = perUserTestOnCreate.get(userName);
- }
+ final Boolean value = get(perUserTestOnCreate, userName);
if (value == null) {
return getDefaultTestOnCreate();
}
@@ -547,10 +506,7 @@ public boolean getPerUserTestOnCreate(final String userName) {
* @return The user specific value.
*/
public boolean getPerUserTestOnReturn(final String userName) {
- Boolean value = null;
- if (perUserTestOnReturn != null) {
- value = perUserTestOnReturn.get(userName);
- }
+ final Boolean value = get(perUserTestOnReturn, userName);
if (value == null) {
return getDefaultTestOnReturn();
}
@@ -566,10 +522,7 @@ public boolean getPerUserTestOnReturn(final String userName) {
* @return The user specific value.
*/
public boolean getPerUserTestWhileIdle(final String userName) {
- Boolean value = null;
- if (perUserTestWhileIdle != null) {
- value = perUserTestWhileIdle.get(userName);
- }
+ final Boolean value = get(perUserTestWhileIdle, userName);
if (value == null) {
return getDefaultTestWhileIdle();
}
@@ -605,7 +558,6 @@ private ObjectPool getPool(final PoolKey poolKey) {
@Override
protected PooledConnectionAndInfo getPooledConnectionAndInfo(final String userName, final String password)
throws SQLException {
-
final PoolKey key = getPoolKey(userName);
ObjectPool pool;
PooledConnectionManager manager;
From f246d38179c4efb644f3598f70c548995c56d53a Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 22 Nov 2024 16:51:23 -0500
Subject: [PATCH 144/169] Javadoc
---
.../apache/commons/dbcp2/datasources/SharedPoolDataSource.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java b/src/main/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java
index a30438881e..1de7ccff7c 100644
--- a/src/main/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java
@@ -53,7 +53,7 @@ public class SharedPoolDataSource extends InstanceKeyDataSource {
private static final long serialVersionUID = -1458539734480586454L;
/**
- * Max total defaults to {@value}.
+ * Max total defaults to {@link GenericKeyedObjectPoolConfig#DEFAULT_MAX_TOTAL}.
*/
private int maxTotal = GenericKeyedObjectPoolConfig.DEFAULT_MAX_TOTAL;
From 28ef1403c774facd715d4e5c8cee238f0276aebb Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 22 Nov 2024 17:54:49 -0500
Subject: [PATCH 145/169] Javadoc
---
src/main/java/org/apache/commons/dbcp2/Utils.java | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/main/java/org/apache/commons/dbcp2/Utils.java b/src/main/java/org/apache/commons/dbcp2/Utils.java
index 16f23a2fff..3020f89339 100644
--- a/src/main/java/org/apache/commons/dbcp2/Utils.java
+++ b/src/main/java/org/apache/commons/dbcp2/Utils.java
@@ -274,6 +274,13 @@ public static String toString(final char[] value) {
return value == null ? null : String.valueOf(value);
}
+ /**
+ * Throws a LifetimeExceededException if the given pooled object's lifetime has exceeded a maximum duration.
+ *
+ * @param p The pooled object to test.
+ * @param maxDuration The maximum lifetime.
+ * @throws LifetimeExceededException Thrown if the given pooled object's lifetime has exceeded a maximum duration.
+ */
public static void validateLifetime(final PooledObject> p, final Duration maxDuration) throws LifetimeExceededException {
if (maxDuration.compareTo(Duration.ZERO) > 0) {
final Duration lifetimeDuration = Duration.between(p.getCreateInstant(), Instant.now());
From 8cfe1bd8a6fd834319d3fc9a971e16f6996f0f03 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 22 Nov 2024 18:01:30 -0500
Subject: [PATCH 146/169] Use try-with-resources
---
.../commons/dbcp2/TestPoolingConnection.java | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/test/java/org/apache/commons/dbcp2/TestPoolingConnection.java b/src/test/java/org/apache/commons/dbcp2/TestPoolingConnection.java
index 27fbccc6d1..eeb6634a34 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestPoolingConnection.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestPoolingConnection.java
@@ -19,6 +19,7 @@
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import java.sql.SQLException;
import java.time.Duration;
import org.apache.commons.pool2.impl.GenericKeyedObjectPool;
@@ -173,11 +174,13 @@ public void testPrepareStatementWithResultSetHoldability() throws Exception {
* Tests DBCP-596 PoolingConnection.toString() causes StackOverflowError.
*/
@Test
- public void testToStringStackOverflow() {
- final PoolingConnection conn = new PoolingConnection(null);
- final GenericKeyedObjectPoolConfig config = new GenericKeyedObjectPoolConfig<>();
- final GenericKeyedObjectPool stmtPool = new GenericKeyedObjectPool<>(conn, config);
- conn.setStatementPool(stmtPool);
- conn.toString();
+ public void testToStringStackOverflow() throws SQLException {
+ try (PoolingConnection conn = new PoolingConnection(null)) {
+ final GenericKeyedObjectPoolConfig config = new GenericKeyedObjectPoolConfig<>();
+ try (GenericKeyedObjectPool stmtPool = new GenericKeyedObjectPool<>(conn, config)) {
+ conn.setStatementPool(stmtPool);
+ }
+ conn.toString();
+ }
}
}
From 95ef723114b03f2826ab1ddc4e29ce1d8c63b983 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 22 Nov 2024 18:03:10 -0500
Subject: [PATCH 147/169] Fix generics warning
---
.../java/org/apache/commons/dbcp2/TestPoolingConnection.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/test/java/org/apache/commons/dbcp2/TestPoolingConnection.java b/src/test/java/org/apache/commons/dbcp2/TestPoolingConnection.java
index eeb6634a34..6bed282433 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestPoolingConnection.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestPoolingConnection.java
@@ -177,7 +177,7 @@ public void testPrepareStatementWithResultSetHoldability() throws Exception {
public void testToStringStackOverflow() throws SQLException {
try (PoolingConnection conn = new PoolingConnection(null)) {
final GenericKeyedObjectPoolConfig