[JENKINS-73170] Upgrade Commons FileUpload from 1.5 to 2.0.0-M2 (#9259)

This commit is contained in:
Basil Crow authored and GitHub committed 2024-05-18 09:42:08 -07:00
1 parent cf9b638244
commit 0117bf3e34
10 files changed
+290 -80

No files matched your search

+13 -2
View File
@@ -80,6 +80,7 @@ import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.RandomAccessFile;
import java.io.Serializable;
import java.io.UncheckedIOException;
import java.io.Writer;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
@@ -132,7 +133,7 @@ import jenkins.util.SystemProperties;
import jenkins.util.VirtualFile;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload2.core.FileItem;
import org.apache.commons.io.input.CountingInputStream;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
@@ -1166,7 +1167,9 @@ public final class FilePath implements SerializableOnlyOverRemoting {
public void copyFrom(FileItem file) throws IOException, InterruptedException {
if (channel == null) {
try {
file.write(new File(remote));
file.write(Paths.get(remote));
} catch (UncheckedIOException e) {
throw e.getCause();
} catch (IOException e) {
throw e;
} catch (Exception e) {
@@ -1180,6 +1183,14 @@ public final class FilePath implements SerializableOnlyOverRemoting {
}
}
/**
* @deprecated use {@link #copyFrom(FileItem)}
*/
@Deprecated
public void copyFrom(org.apache.commons.fileupload.FileItem file) throws IOException, InterruptedException {
copyFrom(file.toFileUpload2FileItem());
}
/**
* Code that gets executed on the machine where the {@link FilePath} is local.
* Used to act on {@link FilePath}.