mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Retain order of produces media types in @ExceptionHandler
Closes gh-35587 Signed-off-by: Igor Murzich <imurzich@gmail.com>
This commit is contained in:
committed by
Sam Brannen
parent
6c5de48059
commit
7699b4af9c
+2
-2
@@ -21,7 +21,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -121,7 +121,7 @@ public class ExceptionHandlerMethodResolver {
|
||||
if (exceptions.isEmpty()) {
|
||||
throw new IllegalStateException("No exception types mapped to " + method);
|
||||
}
|
||||
Set<MediaType> mediaTypes = new HashSet<>();
|
||||
Set<MediaType> mediaTypes = new LinkedHashSet<>();
|
||||
for (String mediaType : exceptionHandler.produces()) {
|
||||
try {
|
||||
mediaTypes.add(MediaType.parseMediaType(mediaType));
|
||||
|
||||
Reference in New Issue
Block a user