Fix StringIndexOutOfBoundsException
Closes gh-29588
This commit is contained in:
@@ -488,7 +488,8 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
// Try to get charset value anyway
|
||||
int charsetIndex = contentType.toLowerCase().indexOf(CHARSET_PREFIX);
|
||||
contentType = contentType.toLowerCase();
|
||||
int charsetIndex = contentType.indexOf(CHARSET_PREFIX);
|
||||
if (charsetIndex != -1) {
|
||||
this.characterEncoding = contentType.substring(charsetIndex + CHARSET_PREFIX.length());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user