-
Notifications
You must be signed in to change notification settings - Fork 38.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix condition for "Too many elements" in MimeTypeUtils.sortBySpecificity()
#31769
Conversation
MimeTypeUtils.sortBySpecificity()
Good catch! Although this is very minor, it is technically a regression. So I've labeled it as such, and we'll back port it to 6.0.x |
@sbrannen in #31254 it was notified To fix it, the proposed change was to modify Instead, the Therefore, the same runtime problem is being reproduced. Only changed This problem was reported in this issue and it was just changed the Why haven't you changed the |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
@jandroalvarez, to ensure the issue you've reported does not get lost, I am going to go ahead and create a new issue based on your input now. So, there's no need for you to create a new issue. |
The fix for #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 gh-31254 See gh-31769 Closes gh-32483
The fix for #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 gh-31254 See gh-31769 Closes gh-32483 (cherry picked from commit ef02f0b)
This PR fixes condition for "Too many elements" in
MimeTypeUtils.sortBySpecificity()
that seems to have been changed accidentally in 05c3ffb to align with its Javadoc again.See gh-31254