You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Belot Thomas <Th...@atosorigin.com> on 2005/11/17 13:30:34 UTC

[FileUpload] Exception during request parsing

Hello everybody, i've got an exception while using :
	DiskFileUpload upload = new DiskFileUpload();
	upload.setSizeMax(getMaxFormSize());
	List items = upload.parseRequest(request);

Exception (fileUpload v1.0):
org.apache.commons.fileupload.FileUploadException: Processing of
multipart/form-data request failed. null
        at
org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase
.java:429)
	  ....

I went into the nightly build code source of FileUploadBase and I'm
wondering a few things :
1) Why don't fileupload chain exceptions instead of using sub
exception's message (which brings the useless null in the log)?
	  catch (IOException e)
        {
            throw new FileUploadException(
                "Processing of " + MULTIPART_FORM_DATA
                    + " request failed. " + e.getMessage());
        }
2) Why don't fileupload close the request InputStream ?
	InputStream input = req.getInputStream();



Thanks for your attention


Thomas

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


Re: [FileUpload] Exception during request parsing

Posted by Martin Cooper <ma...@apache.org>.
On 11/17/05, Belot Thomas <Th...@atosorigin.com> wrote:
>
> Hello everybody, i've got an exception while using :
> DiskFileUpload upload = new DiskFileUpload();
> upload.setSizeMax(getMaxFormSize());
> List items = upload.parseRequest(request);
>
> Exception (fileUpload v1.0):
> org.apache.commons.fileupload.FileUploadException: Processing of
> multipart/form-data request failed. null
> at
> org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase
> .java:429)
> ....


The most common cause of this is that the request has already been consumed,
and is therefore no longer available for parsing by FileUpload.

I went into the nightly build code source of FileUploadBase and I'm
> wondering a few things :
> 1) Why don't fileupload chain exceptions instead of using sub
> exception's message (which brings the useless null in the log)?
> catch (IOException e)
> {
> throw new FileUploadException(
> "Processing of " + MULTIPART_FORM_DATA
> + " request failed. " + e.getMessage());
> }


Because that would limit it to JDK 1.4 or later.

2) Why don't fileupload close the request InputStream ?
> InputStream input = req.getInputStream();


Because it didn't open it. Whoever opened it should close it.

--
Martin Cooper


Thanks for your attention
>
>
> Thomas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>