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 2019/05/03 15:33:31 UTC
[tomcat] 03/03: Update internal fork of Apache Commons FileUpload
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 05323c3d9bf8db4a7e2f7f96defab8ab3d5ef694
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri May 3 16:32:49 2019 +0100
Update internal fork of Apache Commons FileUpload
---
MERGE.txt | 6 +++---
java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java | 3 ++-
java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java | 3 +++
java/org/apache/tomcat/util/http/fileupload/util/Streams.java | 2 +-
webapps/docs/changelog.xml | 4 ++++
5 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/MERGE.txt b/MERGE.txt
index 6233ac1..5687de5 100644
--- a/MERGE.txt
+++ b/MERGE.txt
@@ -51,10 +51,10 @@ FileUpload
Sub-tree:
src/main/java/org/apache/commons/fileupload2
The SHA1 ID for the most recent commit to be merged to Tomcat is:
-2cf7d09fefb17c59e5a776fd6850aebdf41046b2
+41e40479f3000dc456d27951060fda01b87fbe9a (2019-04-24)
-Note: Tomcat's copy of fileupload also includes classes copied manually (rather
- than svn copied) from Commons IO.
+Note: Tomcat's copy of fileupload also includes classes copied manually from
+ Commons IO.
DBCP
----
diff --git a/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java b/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java
index 07dbd51..8eb23c7 100644
--- a/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java
+++ b/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java
@@ -279,6 +279,7 @@ public abstract class FileUploadBase {
try {
FileItemIterator iter = getItemIterator(ctx);
FileItemFactory fac = getFileItemFactory();
+ final byte[] buffer = new byte[Streams.DEFAULT_BUFFER_SIZE];
if (fac == null) {
throw new NullPointerException("No FileItemFactory has been set.");
}
@@ -290,7 +291,7 @@ public abstract class FileUploadBase {
item.isFormField(), fileName);
items.add(fileItem);
try {
- Streams.copy(item.openStream(), fileItem.getOutputStream(), true);
+ Streams.copy(item.openStream(), fileItem.getOutputStream(), true, buffer);
} catch (FileUploadIOException e) {
throw (FileUploadException) e.getCause();
} catch (IOException e) {
diff --git a/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java b/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java
index 87f8a8c..70ee565 100644
--- a/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java
+++ b/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java
@@ -391,6 +391,9 @@ public class DiskFileItem
* in a temporary location so move it to the
* desired file.
*/
+ if (file.exists()) {
+ file.delete();
+ }
if (!outputFile.renameTo(file)) {
BufferedInputStream in = null;
BufferedOutputStream out = null;
diff --git a/java/org/apache/tomcat/util/http/fileupload/util/Streams.java b/java/org/apache/tomcat/util/http/fileupload/util/Streams.java
index d755d7b..feeec94 100644
--- a/java/org/apache/tomcat/util/http/fileupload/util/Streams.java
+++ b/java/org/apache/tomcat/util/http/fileupload/util/Streams.java
@@ -41,7 +41,7 @@ public final class Streams {
* Default buffer size for use in
* {@link #copy(InputStream, OutputStream, boolean)}.
*/
- private static final int DEFAULT_BUFFER_SIZE = 8192;
+ public static final int DEFAULT_BUFFER_SIZE = 8192;
/**
* Copies the contents of the given {@link InputStream}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 4cc2bb1..fbe9bd5 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -210,6 +210,10 @@
When using the <code>OneLineFormatter</code>, don't print a blank line
in the log after printing a stack trace. (markt)
</fix>
+ <add>
+ Update the internal fork of Apache Commons FileUpload to pick up the
+ changes since the Apache Commons FileUpload 1.4 release. (markt)
+ </add>
</changelog>
</subsection>
</section>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org