You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2008/10/27 23:40:49 UTC

svn commit: r708361 - /tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/DeferredFileOutputStream.java

Author: markt
Date: Mon Oct 27 15:40:48 2008
New Revision: 708361

URL: http://svn.apache.org/viewvc?rev=708361&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=46075
Don't automatically create the ByteArrayOutputStream with the full threshold - we probably won't need it in most cases.

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/DeferredFileOutputStream.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/DeferredFileOutputStream.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/DeferredFileOutputStream.java?rev=708361&r1=708360&r2=708361&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/DeferredFileOutputStream.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/DeferredFileOutputStream.java Mon Oct 27 15:40:48 2008
@@ -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;
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org