struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [2/3] struts git commit: WW-4456 - Got NPE when File Upload Limitation exceeds in portal env.
Date Wed, 20 Jan 2016 09:27:10 GMT
WW-4456 - Got NPE when File Upload Limitation exceeds in portal env.

Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/bc8d3746
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/bc8d3746
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/bc8d3746

Branch: refs/heads/master
Commit: bc8d37464756bf821acae003c6a140af6dcbaf09
Parents: c167d6c
Author: Victor Sosa <victornsosa@gmail.com>
Authored: Tue Jan 19 08:54:15 2016 -0400
Committer: Victor Sosa <victornsosa@gmail.com>
Committed: Tue Jan 19 08:54:15 2016 -0400

----------------------------------------------------------------------
 .../dispatcher/multipart/JakartaMultiPartRequest.java   | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/bc8d3746/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java
b/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java
index e9ac67f..643d73d 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java
@@ -83,9 +83,17 @@ public class JakartaMultiPartRequest implements MultiPartRequest {
         try {
             setLocale(request);
             processUpload(request, saveDir);
-        } catch (FileUploadBase.SizeLimitExceededException e) {
+        } catch (FileUploadException e) {
             LOG.warn("Request exceeded size limit!", e);
-            String errorMessage = buildErrorMessage(e, new Object[]{e.getPermittedSize(),
e.getActualSize()});
+            String errorMessage = null;
+            
+            if(e instanceof FileUploadBase.SizeLimitExceededException) {
+                FileUploadBase.SizeLimitExceededException ex = (FileUploadBase.SizeLimitExceededException)
e;
+                errorMessage = buildErrorMessage(e, new Object[]{ex.getPermittedSize(), ex.getActualSize()});
+            } else {
+                errorMessage = buildErrorMessage(e, new Object[]{});
+            }
+            
             if (!errors.contains(errorMessage)) {
                 errors.add(errorMessage);
             }


Mime
View raw message