Skip to content

Commit e76ed49

Browse files
committed
CommonsMultipartResolver explicitly converts FileSizeLimitExceededException
Issue: SPR-14638 (cherry picked from commit 05f74b4)
1 parent aa12288 commit e76ed49

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

spring-web/src/main/java/org/springframework/web/multipart/commons/CommonsMultipartResolver.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -161,8 +161,11 @@ protected MultipartParsingResult parseRequest(HttpServletRequest request) throws
161161
catch (FileUploadBase.SizeLimitExceededException ex) {
162162
throw new MaxUploadSizeExceededException(fileUpload.getSizeMax(), ex);
163163
}
164+
catch (FileUploadBase.FileSizeLimitExceededException ex) {
165+
throw new MaxUploadSizeExceededException(fileUpload.getFileSizeMax(), ex);
166+
}
164167
catch (FileUploadException ex) {
165-
throw new MultipartException("Could not parse multipart servlet request", ex);
168+
throw new MultipartException("Failed to parse multipart servlet request", ex);
166169
}
167170
}
168171

spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/multipart/CommonsPortletMultipartResolver.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -156,8 +156,11 @@ protected MultipartParsingResult parseRequest(ActionRequest request) throws Mult
156156
catch (FileUploadBase.SizeLimitExceededException ex) {
157157
throw new MaxUploadSizeExceededException(fileUpload.getSizeMax(), ex);
158158
}
159+
catch (FileUploadBase.FileSizeLimitExceededException ex) {
160+
throw new MaxUploadSizeExceededException(fileUpload.getFileSizeMax(), ex);
161+
}
159162
catch (FileUploadException ex) {
160-
throw new MultipartException("Could not parse multipart portlet request", ex);
163+
throw new MultipartException("Failed to parse multipart portlet request", ex);
161164
}
162165
}
163166

0 commit comments

Comments
 (0)