diff --git a/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/UriCompliance.java b/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/UriCompliance.java index fffb1cd8bdc7..e1d16ed11e85 100644 --- a/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/UriCompliance.java +++ b/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/UriCompliance.java @@ -357,12 +357,25 @@ private static Set copyOf(Set violations) public static String checkUriCompliance(UriCompliance compliance, HttpURI uri, ComplianceViolation.Listener listener) { - for (UriCompliance.Violation violation : UriCompliance.Violation.values()) + if (uri.hasViolations()) { - if (uri.hasViolation(violation) && (compliance == null || !compliance.allows(violation))) - return violation.getDescription(); - else if (listener != null) - listener.onComplianceViolation(new ComplianceViolation.Event(compliance, violation, uri.toString())); + StringBuilder violations = null; + for (UriCompliance.Violation violation : uri.getViolations()) + { + if (compliance == null || !compliance.allows(violation)) + { + if (listener != null) + listener.onComplianceViolation(new ComplianceViolation.Event(compliance, violation, uri.toString())); + + if (violations == null) + violations = new StringBuilder(); + else + violations.append(", "); + violations.append(violation.getDescription()); + } + } + if (violations != null) + return violations.toString(); } return null; }