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/11/05 17:09:27 UTC

svn commit: r711597 - in /tomcat/tc6.0.x/trunk: STATUS.txt java/org/apache/tomcat/util/http/fileupload/DeferredFileOutputStream.java webapps/docs/changelog.xml

Author: markt
Date: Wed Nov  5 08:09:26 2008
New Revision: 711597

URL: http://svn.apache.org/viewvc?rev=711597&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=46075
Don't create ByteArrayOutputStream at maxmimum possible size

Modified:
    tomcat/tc6.0.x/trunk/STATUS.txt
    tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/DeferredFileOutputStream.java
    tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=711597&r1=711596&r2=711597&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Wed Nov  5 08:09:26 2008
@@ -187,12 +187,6 @@
   +1: fhanik, pero
   -1: 
 
-* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=46075
-  Don't create ByteArrayOutputStream at maxmimum possible size
-  http://svn.apache.org/viewvc?rev=708361&view=rev
-  +1: markt, remm, rjung
-  -1: 
-
 * Start poller before acceptor in NIO, bug 43701
   http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?view=diff&r1=618058&r2=618059
   +1: fhanik

Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/DeferredFileOutputStream.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/DeferredFileOutputStream.java?rev=711597&r1=711596&r2=711597&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/DeferredFileOutputStream.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/DeferredFileOutputStream.java Wed Nov  5 08:09:26 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;
     }
 

Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=711597&r1=711596&r2=711597&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Wed Nov  5 08:09:26 2008
@@ -142,6 +142,11 @@
         (markt)
       </add>
       <fix>
+        <bug>46075</bug>: When uploading files, don't create buffers at the
+        maximum configured size. Use the default size and let the buffers grow
+        to the maximum size if necessary. (markt)
+      </fix>
+      <fix>
         <bug>46085</bug>: Fix a rare thread safety issue with session
         expiration. (markt)
       </fix>



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