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

rmaucher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 54b053a9be7185c25351453f552d3d951e662cd5
Author: opencode <[email protected]>
AuthorDate: Wed Sep 30 22:19:58 2026 +0200

    Guard ClusterSingleSignOn.stopInternal() against a ClassCastException when 
the ReplicatedMap was never created after a failed start
---
 java/org/apache/catalina/ha/authenticator/ClusterSingleSignOn.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/ha/authenticator/ClusterSingleSignOn.java 
b/java/org/apache/catalina/ha/authenticator/ClusterSingleSignOn.java
index 68df995d42..25ceaa8924 100644
--- a/java/org/apache/catalina/ha/authenticator/ClusterSingleSignOn.java
+++ b/java/org/apache/catalina/ha/authenticator/ClusterSingleSignOn.java
@@ -263,8 +263,11 @@ public class ClusterSingleSignOn extends SingleSignOn 
implements ClusterValve, M
 
         super.stopInternal();
 
-        if (getCluster() != null) {
-            ((ReplicatedMap<?,?>) cache).breakdown();
+        // The cache is only a ReplicatedMap if start completed successfully.
+        // If the ReplicatedMap creation failed, the base class 
ConcurrentHashMap
+        // is still in place.
+        if (cache instanceof ReplicatedMap<?,?> map) {
+            map.breakdown();
         }
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to