Skip to content

Improve MimeTypeUtils to handle the case of only a delimiter passed [SPR-14124] #18696

@spring-projects-issues

Description

@spring-projects-issues

Tomoya Honjo opened SPR-14124 and commented

MimeTypeUtil#parseMimeType throws java.lang.ArrayIndexOutOfBoundsException when only delimiter ";" passed as the argument. Because in the method it parse the argument by StringUtils.tokenizeToStringArray(mimeType, ";"); but, it returns an empty array only passed the delimiter, so the exception is thrown by this next line String fullType = parts[0].trim();

For such a case, there is the dedicated exception InvalidMimeTypeException which express passed mimetype string cannot be parsed, so it's better to throw the exception.


Affects: 4.1.7

Reference URL: #1016

Referenced from: commits 50c1102

1 votes, 2 watchers

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions