From 10838a636fbbd4a95ac3652bc7209e98c6a11f6c Mon Sep 17 00:00:00 2001 From: kacperkrzyzak Date: Tue, 5 Jul 2022 14:55:42 +0200 Subject: [PATCH 1/2] 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 --- .../support/StandardMultipartHttpServletRequest.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spring-web/src/main/java/org/springframework/web/multipart/support/StandardMultipartHttpServletRequest.java b/spring-web/src/main/java/org/springframework/web/multipart/support/StandardMultipartHttpServletRequest.java index 6970c8e12ea..ac367a2a5eb 100644 --- a/spring-web/src/main/java/org/springframework/web/multipart/support/StandardMultipartHttpServletRequest.java +++ b/spring-web/src/main/java/org/springframework/web/multipart/support/StandardMultipartHttpServletRequest.java @@ -118,8 +118,11 @@ public class StandardMultipartHttpServletRequest extends AbstractMultipartHttpSe protected void handleParseFailure(Throwable ex) { String msg = ex.getMessage(); - if (msg != null && msg.contains("size") && msg.contains("exceed")) { - throw new MaxUploadSizeExceededException(-1, ex); + if (msg != null) { + 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); } From 222dbf837702ac01b04c42432f4995dd7d2f1b08 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Wed, 13 Jul 2022 13:22:40 +0200 Subject: [PATCH 2/2] Update copyright date --- .../multipart/support/StandardMultipartHttpServletRequest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-web/src/main/java/org/springframework/web/multipart/support/StandardMultipartHttpServletRequest.java b/spring-web/src/main/java/org/springframework/web/multipart/support/StandardMultipartHttpServletRequest.java index ac367a2a5eb..88bfdd4f2aa 100644 --- a/spring-web/src/main/java/org/springframework/web/multipart/support/StandardMultipartHttpServletRequest.java +++ b/spring-web/src/main/java/org/springframework/web/multipart/support/StandardMultipartHttpServletRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.