This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 69b92c479c7e0e079329caf71f63df131b0829e1 Author: Mark Thomas <ma...@apache.org> AuthorDate: Mon Feb 12 14:24:02 2024 +0000 Fix back-port (no lambda with Java 7) --- java/org/apache/catalina/core/ApplicationHttpRequest.java | 9 ++++++--- java/org/apache/catalina/core/ApplicationRequest.java | 12 ++++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/java/org/apache/catalina/core/ApplicationHttpRequest.java b/java/org/apache/catalina/core/ApplicationHttpRequest.java index 8142a3bd05..cc18bdb925 100644 --- a/java/org/apache/catalina/core/ApplicationHttpRequest.java +++ b/java/org/apache/catalina/core/ApplicationHttpRequest.java @@ -83,15 +83,18 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper { * It may be possible to remove specials but that will require changes to AttributeNamesEnumerator. */ private static final Map<String,Integer> specialsMap = new HashMap<>(); + private static final int shortestSpecialNameLength; static { + int minLength = Integer.MAX_VALUE; for (int i = 0; i < specials.length; i++) { specialsMap.put(specials[i], Integer.valueOf(i)); + if (specials[i].length() < minLength) { + minLength = specials[i].length(); + } } + shortestSpecialNameLength = minLength; } - private static final int shortestSpecialNameLength = - specialsMap.keySet().stream().mapToInt(s -> s.length()).min().getAsInt(); - private static final int SPECIALS_FIRST_FORWARD_INDEX = 6; diff --git a/java/org/apache/catalina/core/ApplicationRequest.java b/java/org/apache/catalina/core/ApplicationRequest.java index 5828045816..e5ec6729af 100644 --- a/java/org/apache/catalina/core/ApplicationRequest.java +++ b/java/org/apache/catalina/core/ApplicationRequest.java @@ -59,8 +59,16 @@ class ApplicationRequest extends ServletRequestWrapper { */ private static final Set<String> specialsSet = new HashSet<>(Arrays.asList(specials)); - private static final int shortestSpecialNameLength = - specialsSet.stream().mapToInt(s -> s.length()).min().getAsInt(); + private static final int shortestSpecialNameLength; + static { + int minLength = Integer.MAX_VALUE; + for (String special : specialsSet) { + if (special.length() < minLength) { + minLength = special.length(); + } + } + shortestSpecialNameLength = minLength; + } /** --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org