Correctly identify MaxUploadSizeExceededException in StandardMultipartHttpServletRequest

This commit correctly identifies MaxUploadSizeExceededException in
StandardMultipartHttpServletRequest by converting keywords in the
exception message to lowercase before checking for their presence, for
compatibility with Jetty 9.4.x.

Closes gh-28759
This commit is contained in:
kacperkrzyzak 2022-07-05 14:55:42 +02:00 committed by Sam Brannen
parent 3c3ae32f07
commit 10838a636f
1 changed files with 5 additions and 2 deletions

View File

@ -118,8 +118,11 @@ public class StandardMultipartHttpServletRequest extends AbstractMultipartHttpSe
protected void handleParseFailure(Throwable ex) { protected void handleParseFailure(Throwable ex) {
String msg = ex.getMessage(); String msg = ex.getMessage();
if (msg != null && msg.contains("size") && msg.contains("exceed")) { if (msg != null) {
throw new MaxUploadSizeExceededException(-1, ex); msg = msg.toLowerCase();
if (msg.contains("size") && msg.contains("exceed")) {
throw new MaxUploadSizeExceededException(-1, ex);
}
} }
throw new MultipartException("Failed to parse multipart servlet request", ex); throw new MultipartException("Failed to parse multipart servlet request", ex);
} }