commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Cooper" <mart...@apache.org>
Subject Re: Problem with form parameter files
Date Thu, 13 Feb 2003 06:30:00 GMT

<faustas.zilinskas@wachovia.com> wrote in message
news:OF59950584.A15A6630-ON85256CCB.007B2092@infra.fub.com...
>
>
> Judging from the source, the size treshold parameter applies to the size
of
> the whole request.
> No matter how small your parts are they will be written to the disk if the
> size of the whole request is bigger than the treshold size.
> I guess this behavior needs to be revisited.

I'll take a look.

>
> In order to solve the problem, all I did was to add fis.close() in the
> DefaultFileItem.get():
>                 try
>                 {
>                     FileInputStream fis = new
> FileInputStream(storeLocation);
>                     fis.read(content);
>                     --->fis.close();<---
>                 }
>                 catch (Exception e)
>                 {
>                     content = null;
>                 }
>
> This fixed the problem for me.
>
> I don't feel like filing  a separate bug report, I hope this will be
> enough. I'm lazy...

Please file a bug report anyway. We committers can be even lazier. ;-) A
post to the list is easily missed in the crowd, but a bug report will stay
there until someone deliberately makes it go away.

--
Martin Cooper


>
> Faustas
>
>
>
>
>
> "Martin Cooper" <martinc@apache.org>@main.gmane.org> on 02/12/2003
12:55:22
> AM
>
> Please respond to "Jakarta Commons Users List"
>        <commons-user@jakarta.apache.org>
>
> Sent by:    news <news@main.gmane.org>
>
>
> To:    commons-user@jakarta.apache.org
> cc:
>
> Subject:    Re: Problem with form parameter files
>
>
>
> <faustas.zilinskas@wachovia.com> wrote in message
> news:OF6B5A094A.85C158D7-ON85256CCA.00812BBA@infra.fub.com...
> >
> > Hi,
> >
> > In my multipart form I have one simple form parameter and 3 "file" type
> > parameters.
> > When I upload and parse it with Fileupload, 4 files get created.
> >
> > After I'm done with the request,
> > I'm calling FileItem.delete() for all of them, but only three files get
> > deleted: the one that contains the simple form
> > parameter doesn't get deleted. When I try to delete it manually, I get
> > "Sharing violation error", which means
> > that there is another process who has the file open. Only after I
> shutdown
> > the JVM I can delete the file.
> >
> > Does anyone know what's wrong? I checked DefaultFileItem.get() and it
> seems
> > that it's not closing the stream
> > after reading the contents of the file. Is this a correct behavior?
>
> This looks like a bug. Please file a bug report here:
>
> http://jakarta.apache.org/site/bugs.html
>
> However, the fact that your regular form item is being stored as a file,
> rather than in memory, suggests that you may not be configuring your
> FileUpload instance appropriately. Make sure you are specifying a
> reasonable
> value for the sizeThreshold parameter to parseRequest().
>
> --
> Martin Cooper
>
>
> >
> > I'm using Windows 2000 + 1.4.1 JVM +Tomcat 4.1.18.
> >
> > Thank you
> > Faustas
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org




Mime
View raw message