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 5ed30e25565348be0837e3d20734aabd178be416
Author: Gary D. Gregory <garydgreg...@gmail.com>
AuthorDate: Sun May 25 18:19:25 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.cpdsadapter.PooledConnectionImpl]
    AT_STALE_THREAD_WRITE_OF_PRIMITIVE
    
    Can't update from parent pom 81 yet
---
 pom.xml                                                                 | 2 +-
 src/changes/changes.xml                                                 | 1 +
 .../java/org/apache/commons/dbcp2/cpdsadapter/PooledConnectionImpl.java | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index f3d58cd5..186e89ec 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
   <parent>
     <groupId>org.apache.commons</groupId>
     <artifactId>commons-parent</artifactId>
-    <version>83</version>
+    <version>81</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>commons-dbcp2</artifactId>
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 568a0f01..54220126 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -76,6 +76,7 @@ The <action> type attribute can be add,update,fix,remove.
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Remove -nouses 
directive from maven-bundle-plugin. OSGi package imports now state 'uses' 
definitions for package imports, this doesn't affect JPMS (from 
org.apache.commons:commons-parent:80).</action>
       <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>
       <!-- 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/cpdsadapter/PooledConnectionImpl.java 
b/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PooledConnectionImpl.java
index a65317de..1d27f855 100644
--- 
a/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PooledConnectionImpl.java
+++ 
b/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PooledConnectionImpl.java
@@ -81,7 +81,7 @@ final class PooledConnectionImpl
     /**
      * Flag set to true, once {@link #close()} is called.
      */
-    private boolean closed;
+    private volatile boolean closed;
 
     /** My pool of {@link PreparedStatement}s. */
     private KeyedObjectPool<PStmtKey, DelegatingPreparedStatement> stmtPool;

Reply via email to