|
Created an attachment (id=8858)
patch to fix the bug I'm not sure I understand what you're doing. Are you trying to keep everything
in memory, and prevent anything from being written to disk? If so, why are you trying to use *Disk*FileUpload? You should be using a custom implementation for that. If that's not what you're trying to do, then why are you setting the in- memory threshold so high? The idea behind the disk implementation is that small fields - typically the I don't understand you're point about ByteArrayOutputStream and byte[]. Why are The scenario I'm dealing is a form with a lot of non-form inputs, and 1 form
input that I want to process in memory when possible, but write to disk when not. I chose a higher in memory threshold because that seems to get the best throughput in our situation. My main issue with the current design is that it preallocates the in memory My point about ByteArrayOutputStream and byte[] was that since you can't do Changing from a bug to an enhancement.
I intend to resolve this by using the ByteArrayOutputStream implementation from Would it make sense to copy that one class into commons-fileupload rather than
incur a dependency on all of commons-io ? It seems like this has recently come up as a strategy for dealing with commons interdependencies, and it seems like there are cases where it is justifiable. Perhaps, if it was just that one class. However, two classes from FileUpload
have moved (well, there are copies for now) to IO, and another class has been added to IO that needs to be picked up and used in FileUpload, so there are 4 classes in IO that FileUpload wants. I think at that point that a dependency is warranted. I encountered this problem, too.
My form contained about 15 form fields and 5 file upload fields. My threshold was 1 MB and so I wasted about 20 MB. Simple workaround: I subclassed DefaultFileItemFactory and added a Usage: This created a FileUpload with thresholds of 1 MB for files and 1 KB for form Created an attachment (id=12996)
FileItemFactory with different Thresholds for file items and form fields Fixed in the 10/11/04 nightly builds of Commons FileUpload and Commons IO.
FileUpload has been changed to depend on Commons IO, and Commons IO has been Created an attachment (id=13106)
Patch to DefaultFileItemFactory from FILEUPLOAD_1_0 Added a patch based on FileUpload 1.0 (FILEUPLOAD_1_0 tag) that uses 1024 for
non-file form fields. Incidentally, isn't it a bit of a misnomer to call this value a "threshhold"? We are using the attached patch for our production system now. I'm unclear as to why you are adding a patch here - if you check the log you'll
see that this bug was fixed four days ago. As for why the value is called a threshold, it's because this is the threshold below which the item is retained in memory and above which it is written to disk. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
a simple servlet that repeats the error