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

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-dbcp.git


The following commit(s) were added to refs/heads/master by this push:
     new c4c4b495 Fix unguarded read
c4c4b495 is described below

commit c4c4b495549d9887b7d5546b57b8a1a1ae824ae9
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Aug 28 18:25:13 2025 +0100

    Fix unguarded read
    
    All current calls to this method are from a synchronized method so this
    change is a NO-OP for DBCP but it does make clear to any sub-classes
    that any over-riding method should be synchronized
    
    Identified by Coverity scan running on Tomcat's fork of DBCP
---
 .../java/org/apache/commons/dbcp2/managed/BasicManagedDataSource.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 3bb6a0d5..8ffb0461 100644
--- a/src/main/java/org/apache/commons/dbcp2/managed/BasicManagedDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/managed/BasicManagedDataSource.java
@@ -74,7 +74,7 @@ public class BasicManagedDataSource extends BasicDataSource {
     }
 
     @Override
-    protected ConnectionFactory createConnectionFactory() throws SQLException {
+    protected synchronized ConnectionFactory createConnectionFactory() throws 
SQLException {
         if (transactionManager == null) {
             throw new SQLException("Transaction manager must be set before a 
connection can be created");
         }

Reply via email to