diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/UriCompliance.java b/jetty-http/src/main/java/org/eclipse/jetty/http/UriCompliance.java index 63d01ad557d..25b169a5afb 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/UriCompliance.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/UriCompliance.java @@ -13,8 +13,8 @@ package org.eclipse.jetty.http; -import java.util.Arrays; import java.util.EnumSet; +import java.util.List; import java.util.Objects; import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; @@ -156,10 +156,11 @@ public final class UriCompliance implements ComplianceViolation.Mode public static final UriCompliance STRICT = new UriCompliance("STRICT", RFC3986.getAllowed()); private static final AtomicInteger __custom = new AtomicInteger(); + private static final List KNOWN_MODES = List.of(DEFAULT, LEGACY, RFC3986, RFC3986_UNAMBIGUOUS, UNSAFE, SAFE, STRICT); public static UriCompliance valueOf(String name) { - for (UriCompliance compliance : Arrays.asList(DEFAULT, LEGACY, RFC3986, RFC3986_UNAMBIGUOUS, UNSAFE, SAFE, STRICT)) + for (UriCompliance compliance : KNOWN_MODES) { if (compliance.getName().equals(name)) return compliance;