Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wrap InvalidMimeTypeException in HttpMediaTypeNotAcceptableException
The fix for spring-projects#31254 resulted in an InvalidMimeTypeException being thrown by MimeTypeUtils.sortBySpecificity() instead of an IllegalArgumentException. However, InvalidMimeTypeException extends IllegalArgumentException. Consequently, the change from IllegalArgumentException to InvalidMimeTypeException did not result in the desired effect in HeaderContentNegotiationStrategy. HeaderContentNegotiationStrategy.resolveMediaTypes() still allows the InvalidMimeTypeException to propagate as-is without wrapping it in an HttpMediaTypeNotAcceptableException. To address this issue, this commit catches InvalidMediaTypeException and InvalidMimeTypeException in HeaderContentNegotiationStrategy and wraps the exception in an HttpMediaTypeNotAcceptableException. See spring-projectsgh-31254 See spring-projectsgh-31769 Closes spring-projectsgh-32483 (cherry picked from commit ef02f0b)
- Loading branch information