Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.1.9
-
None
-
None
-
commons-fileupload-1.2.1
Description
With the extensions filter configured with cacheFileSizeErrors=true and uploadMaxFileSize=1M, I get the stacktrace below when uploading a file larger than 1M.
This is NOT the expected stack trace.
Note that ServletChacheFileSizeErrorsFileUpload is used.
However, line 108 in that class has a comment which states that the line "throws a SizeLimitExceededException (wrapped by a FileUploadIOException) if the request is longer than the max size"
That is not accurrate. The SizeLimitExceededException is NOT, in fact, wrapped.
As a result, ServletChacheFileSizeErrorsFileUpload does not trap exceptions at the right level and the SizeLimitExceededException bubbles up to the MultipartRequestWrapper (which is the source of the WARN - level stack trace below).
Basically, this behaviour renders the cacheFileSizeErrors property useless.
Here's the stacktrace:
2010-06-15 15:07:57,234 WARN org.apache.myfaces.webapp.filter.MultipartRequestWrapper] - <SizeLimitExceededException while uploading file.> []
org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (3506126) exceeds the configured maximum (1048576)
at org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.<init>(FileUploadBase.java:914)
at org.apache.commons.fileupload.FileUploadBase.getItemIterator(FileUploadBase.java:331)
at org.apache.myfaces.webapp.filter.servlet.ServletChacheFileSizeErrorsFileUpload.parseRequestCatchingFileSizeErrors(ServletChacheFileSizeErrorsFileUpload.java:108)
at org.apache.myfaces.webapp.filter.MultipartRequestWrapper.parseRequest(MultipartRequestWrapper.java:131)
at org.apache.myfaces.webapp.filter.MultipartRequestWrapper.getParameter(MultipartRequestWrapper.java:274)
at javax.servlet.ServletRequestWrapper.getParameter(ServletRequestWrapper.java:158)