This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-dbcp.git
commit 3af43c9fb0bb24bd6f6c22be01b6ffcd3fd1542e Author: Gary D. Gregory <garydgreg...@gmail.com> AuthorDate: Mon May 26 09:48:18 2025 -0400 Fix SpotBugs [ERROR] Medium: Shared primitive variable "closed" in one thread may not yield the value of the most recent write from another thread [org.apache.commons.dbcp2.DelegatingStatement] AT_STALE_THREAD_WRITE_OF_PRIMITIVE --- src/changes/changes.xml | 1 + src/main/java/org/apache/commons/dbcp2/DelegatingStatement.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 54220126..7059bf33 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -77,6 +77,7 @@ The <action> type attribute can be add,update,fix,remove. <action type="fix" dev="ggregory" due-to="Gary Gregory">XAException thrown by LocalXAResource now all include a message.</action> <action type="fix" dev="ggregory" due-to="Gary Gregory">Fix SpotBugs [ERROR] Medium: Shared primitive variable "isSharedConnection" in one thread may not yield the value of the most recent write from another thread [org.apache.commons.dbcp2.managed.ManagedConnection] AT_STALE_THREAD_WRITE_OF_PRIMITIVE.</action> <action type="fix" dev="ggregory" due-to="Gary Gregory">Fix SpotBugs [ERROR] Medium: Shared primitive variable "closed" in one thread may not yield the value of the most recent write from another thread [org.apache.commons.dbcp2.cpdsadapter.PooledConnectionImpl] AT_STALE_THREAD_WRITE_OF_PRIMITIVE.</action> + <action type="fix" dev="ggregory" due-to="Gary Gregory">Fix SpotBugs [ERROR] Medium: Shared primitive variable "closed" in one thread may not yield the value of the most recent write from another thread [org.apache.commons.dbcp2.DelegatingStatement] AT_STALE_THREAD_WRITE_OF_PRIMITIVE.</action> <!-- ADD --> <!-- UPDATE --> <action type="update" dev="ggregory" due-to="Gary Gregory">Bump org.apache.commons:commons-parent from 78 to 81.</action> diff --git a/src/main/java/org/apache/commons/dbcp2/DelegatingStatement.java b/src/main/java/org/apache/commons/dbcp2/DelegatingStatement.java index c7ea2168..304d6365 100644 --- a/src/main/java/org/apache/commons/dbcp2/DelegatingStatement.java +++ b/src/main/java/org/apache/commons/dbcp2/DelegatingStatement.java @@ -44,7 +44,7 @@ public class DelegatingStatement extends AbandonedTrace implements Statement { /** The connection that created me. **/ private DelegatingConnection<?> connection; - private boolean closed; + private volatile boolean closed; /** * Create a wrapper for the Statement which traces this Statement to the Connection which created it and the code