This is an automated email from the ASF dual-hosted git repository. rmaucher pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit febd7177ec218271f48dc5d5c259e9e1de6c1158 Author: opencode <[email protected]> AuthorDate: Wed Sep 30 22:52:02 2026 +0200 Make MultiEnumeration.nextElement throw NoSuchElementException when exhausted and report attribute names present in both stores only once --- java/org/apache/catalina/ha/context/ReplicatedContext.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/java/org/apache/catalina/ha/context/ReplicatedContext.java b/java/org/apache/catalina/ha/context/ReplicatedContext.java index 4dda906f1a..027453a209 100644 --- a/java/org/apache/catalina/ha/context/ReplicatedContext.java +++ b/java/org/apache/catalina/ha/context/ReplicatedContext.java @@ -20,6 +20,7 @@ import java.util.Collections; import java.util.Enumeration; import java.util.HashSet; import java.util.Map; +import java.util.NoSuchElementException; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; @@ -278,6 +279,8 @@ public class ReplicatedContext extends StandardContext implements MapOwner { @Override public Enumeration<String> getAttributeNames() { Set<String> names = new HashSet<>(tomcatAttributes.keySet()); + // Names that are present in both stores are only reported once + names.removeAll(attributes.keySet()); return new MultiEnumeration<String>( new Enumeration[] { super.getAttributeNames(), Collections.enumeration(names) }); @@ -321,8 +324,7 @@ public class ReplicatedContext extends StandardContext implements MapOwner { return enumeration.nextElement(); } } - return null; - + throw new NoSuchElementException(); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
