From 05f74b42186243e3f90bb87555ff75fa3a29b9ee Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 30 Aug 2016 12:57:46 +0200 Subject: [PATCH] CommonsMultipartResolver explicitly converts FileSizeLimitExceededException Issue: SPR-14638 (cherry picked from commit 58ffca7) --- .../web/multipart/commons/CommonsMultipartResolver.java | 7 +++++-- .../portlet/multipart/CommonsPortletMultipartResolver.java | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/spring-web/src/main/java/org/springframework/web/multipart/commons/CommonsMultipartResolver.java b/spring-web/src/main/java/org/springframework/web/multipart/commons/CommonsMultipartResolver.java index 22960e3811c..f4226d5afee 100644 --- a/spring-web/src/main/java/org/springframework/web/multipart/commons/CommonsMultipartResolver.java +++ b/spring-web/src/main/java/org/springframework/web/multipart/commons/CommonsMultipartResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2016 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. @@ -161,8 +161,11 @@ public class CommonsMultipartResolver extends CommonsFileUploadSupport catch (FileUploadBase.SizeLimitExceededException ex) { throw new MaxUploadSizeExceededException(fileUpload.getSizeMax(), ex); } + catch (FileUploadBase.FileSizeLimitExceededException ex) { + throw new MaxUploadSizeExceededException(fileUpload.getFileSizeMax(), ex); + } catch (FileUploadException ex) { - throw new MultipartException("Could not parse multipart servlet request", ex); + throw new MultipartException("Failed to parse multipart servlet request", ex); } } diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/multipart/CommonsPortletMultipartResolver.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/multipart/CommonsPortletMultipartResolver.java index 2644f2c8450..2c95b02e350 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/multipart/CommonsPortletMultipartResolver.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/multipart/CommonsPortletMultipartResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2016 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. @@ -156,8 +156,11 @@ public class CommonsPortletMultipartResolver extends CommonsFileUploadSupport catch (FileUploadBase.SizeLimitExceededException ex) { throw new MaxUploadSizeExceededException(fileUpload.getSizeMax(), ex); } + catch (FileUploadBase.FileSizeLimitExceededException ex) { + throw new MaxUploadSizeExceededException(fileUpload.getFileSizeMax(), ex); + } catch (FileUploadException ex) { - throw new MultipartException("Could not parse multipart portlet request", ex); + throw new MultipartException("Failed to parse multipart portlet request", ex); } }