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

tolbertam pushed a commit to branch 4.x
in repository https://gitbox.apache.org/repos/asf/cassandra-java-driver.git


The following commit(s) were added to refs/heads/4.x by this push:
     new dfe11a8b6 Fix CustomCcmRule to drop `CURRENT` flag no matter what
dfe11a8b6 is described below

commit dfe11a8b671d76be6c4e90981a736325b0e4719b
Author: Dmitry Kropachev <dmitry.kropac...@gmail.com>
AuthorDate: Sat Sep 14 06:43:15 2024 -0400

    Fix CustomCcmRule to drop `CURRENT` flag no matter what
    
    If super.after() throws an Exception `CURRENT` flag is never dropped
    which leads next tests to fail with IllegalStateException("Attempting to 
use a Ccm rule while another is in use.  This is disallowed")
    
    Patch by Dmitry Kropachev; reviewed by Andy Tolbert and Bret McGuire for 
JAVA-3117
---
 .../com/datastax/oss/driver/api/testinfra/ccm/CustomCcmRule.java  | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm/CustomCcmRule.java
 
b/test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm/CustomCcmRule.java
index cf150b12f..5ea1bf7ed 100644
--- 
a/test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm/CustomCcmRule.java
+++ 
b/test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm/CustomCcmRule.java
@@ -53,6 +53,7 @@ public class CustomCcmRule extends BaseCcmRule {
           after();
         } catch (Exception e1) {
           LOG.warn("Error cleaning up CustomCcmRule before() failure", e1);
+          e.addSuppressed(e1);
         }
         throw e;
       }
@@ -64,8 +65,11 @@ public class CustomCcmRule extends BaseCcmRule {
 
   @Override
   protected void after() {
-    super.after();
-    CURRENT.compareAndSet(this, null);
+    try {
+      super.after();
+    } finally {
+      CURRENT.compareAndSet(this, null);
+    }
   }
 
   public CcmBridge getCcmBridge() {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to