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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to