commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Wechner <michael.wech...@wyona.com>
Subject Prevent empty list when parsing request using ServletFileUpload by being more fault tolerant
Date Sat, 14 Dec 2013 22:13:50 GMT
Hi

I am using ServletFileUpload in order to manage file uploads inside the
Yanel content management system.
When setting a maximum file size, and a user submits a file which is
exceeding the max file size, then I receive the following exception:

108607 2013-12-14 22:45:16,770 +0100 [http-bio-8080-exec-7] ERROR
org.wyona.yanel.servlet.communication.HttpRequest.<init>():96 [] {} -
org.apache.commons.fileupload.FileUploadBase$FileSizeLimitExceededException:
The field image-data exceeds its maximum permitted  size of 3000000
characters.
org.apache.commons.fileupload.FileUploadBase$FileSizeLimitExceededException:
The field image-data exceeds its maximum permitted  size of 3000000
characters.
    at
org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl$FileItemStreamImpl$1.raiseError(FileUploadBase.java:645)
~[commons-fileupload-1.2.jar:?]
    at
org.apache.commons.fileupload.util.LimitedInputStream.checkLimit(LimitedInputStream.java:71)
~[commons-fileupload-1.2.jar:?]
    at
org.apache.commons.fileupload.util.LimitedInputStream.read(LimitedInputStream.java:128)
~[commons-fileupload-1.2.jar:?]
    at java.io.FilterInputStream.read(FilterInputStream.java:90)
~[?:1.6.0_45]
    at org.apache.commons.fileupload.util.Streams.copy(Streams.java:94)
~[commons-fileupload-1.2.jar:?]
    at org.apache.commons.fileupload.util.Streams.copy(Streams.java:64)
~[commons-fileupload-1.2.jar:?]
    at
org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:354)
~[commons-fileupload-1.2.jar:?]
    at
org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126)
~[commons-fileupload-1.2.jar:?]
    at
org.wyona.yanel.servlet.communication.HttpRequest.<init>(HttpRequest.java:93)
[yanel-webapp-2.1.0-rREVISION.jar:?]
    at
org.wyona.yanel.servlet.communication.YanelFilter.doFilter(YanelFilter.java:58)
[yanel-webapp-2.1.0-rREVISION.jar:?]
    at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
[catalina.jar:7.0.25]


which is ok, but the problem is that the list of items will be null,
which means the other request parameters will not be available anymore,
which means we will loose a lot of information which the user has submitted.

I think it would be better if one could "configure" FileUploadBase
somehow more fault tolerant

http://svn.apache.org/viewvc/commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/FileUploadBase.java?revision=1458220&view=markup

such that all parameters which are ok will still be available.

WDYT?

Thanks

Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message