Consistent ordering in MethodNotAllowedException

This caused random failures in a newly added test. Also remove defensive
check in ResponseStatusExceptionResolver.

See gh-24944
This commit is contained in:
Rossen Stoyanchev
2020-04-25 07:33:30 +01:00
parent 2002a1689a
commit 583435d068
2 changed files with 4 additions and 7 deletions

View File

@@ -18,7 +18,7 @@ package org.springframework.web.server;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
@@ -54,7 +54,7 @@ public class MethodNotAllowedException extends ResponseStatusException {
supportedMethods = Collections.emptySet();
}
this.method = method;
this.httpMethods = Collections.unmodifiableSet(new HashSet<>(supportedMethods));
this.httpMethods = Collections.unmodifiableSet(new LinkedHashSet<>(supportedMethods));
}