You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The method org.springframework.http.MediaType.parseMediaType does not always throw IllegalArgumentException as the documentantion claims [SPR-6786] #11452
For example, the following invocation throws a StringIndexOutOfBoundsException:
MediaType.parseMediaType("audio");
(because the implementation assumes existance of a slash and does not check the value of the index before trying to get the assumed substrings separated by slashes)
The following input string passes without getting IllegalArgumentException:
but when you then invoke 'mediaType.getQualityValue()' you get a NumberFormatException.
This validation should be taken care of by the parser method as the documentation claims.
Except from these kind of obvious and easy fixes, I wonder if there also should not be some kind of sanity check, or if it should be considered as correct behaviour that the following kind of test currently passes green: