Restore StringUtils.hasLength check

Update `MimeTypeUtils` so that the  StringUtils.hasLength check is
performed immediately on the incoming argument, rather than in
`parseMimeTypeInternal`. This restores the `IllegalArgumentException`
rather than the `NullPointerException` which is thrown by the
`ConcurrentHashMap`.

Closes gh-23215
See gh-23211
This commit is contained in:
Phillip Webb
2019-06-29 22:15:13 -07:00
parent 87c15ba9ad
commit b3d56ebf3b
2 changed files with 9 additions and 4 deletions

View File

@@ -285,6 +285,12 @@ public class MimeTypeTests {
MimeTypeUtils.parseMimeType("audio/*;attr=\""));
}
@Test
public void parseMimeTypeNull() {
assertThatExceptionOfType(InvalidMimeTypeException.class).isThrownBy(() ->
MimeTypeUtils.parseMimeType(null));
}
@Test
public void parseMimeTypes() {
String s = "text/plain, text/html, text/x-dvi, text/x-c";