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

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

commit 7ae6a1150a34c9a88b1e300540d53ca3a264981e
Author: opencode <[email protected]>
AuthorDate: Wed Sep 30 10:54:55 2026 +0200

    Return a snapshot enumeration from Request.getLocales() to prevent 
ConcurrentModificationExceptions when the locales list is modified while a 
previously returned enumeration is being iterated
---
 java/org/apache/catalina/connector/Request.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/connector/Request.java 
b/java/org/apache/catalina/connector/Request.java
index 4dfbe0ce16..d17b522151 100644
--- a/java/org/apache/catalina/connector/Request.java
+++ b/java/org/apache/catalina/connector/Request.java
@@ -1133,7 +1133,9 @@ public class Request implements HttpServletRequest {
         }
 
         if (!locales.isEmpty()) {
-            return Collections.enumeration(locales);
+            // Take a copy to prevent ConcurrentModificationExceptions if the
+            // list is modified while the enumeration is being iterated
+            return Collections.enumeration(new ArrayList<>(locales));
         }
         ArrayList<Locale> results = new ArrayList<>();
         results.add(defaultLocale);


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

Reply via email to