Author: remy.maucherat(a)jboss.com
Date: 2008-10-28 11:47:17 -0400 (Tue, 28 Oct 2008)
New Revision: 821
Modified:
trunk/java/org/apache/tomcat/util/http/fileupload/DeferredFileOutputStream.java
Log:
- Memory fix for fileupload.
Modified: trunk/java/org/apache/tomcat/util/http/fileupload/DeferredFileOutputStream.java
===================================================================
---
trunk/java/org/apache/tomcat/util/http/fileupload/DeferredFileOutputStream.java 2008-10-28
15:41:35 UTC (rev 820)
+++
trunk/java/org/apache/tomcat/util/http/fileupload/DeferredFileOutputStream.java 2008-10-28
15:47:17 UTC (rev 821)
@@ -84,7 +84,14 @@
super(threshold);
this.outputFile = outputFile;
- memoryOutputStream = new ByteArrayOutputStream(threshold);
+ if (threshold < DefaultFileItemFactory.DEFAULT_SIZE_THRESHOLD) {
+ // Small threshold, use it
+ memoryOutputStream = new ByteArrayOutputStream(threshold);
+ } else {
+ // Large threshold. Use default and array will expand if required
+ memoryOutputStream = new ByteArrayOutputStream(
+ DefaultFileItemFactory.DEFAULT_SIZE_THRESHOLD);
+ }
currentOutputStream = memoryOutputStream;
}
Show replies by date