Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBob Foster2015-05-13 17:36:47 -0400
committerBob Foster2015-05-13 17:36:47 -0400
commit29de547ac87619b9cd325719faab39ca9a49aa41 (patch)
tree2e6d0dec968d0f05c859421918c89da840e6641e
parent497a7c9401645ebe247d86bfc7980472603fb387 (diff)
downloadorg.eclipse.hudson.core-29de547ac87619b9cd325719faab39ca9a49aa41.tar.gz
org.eclipse.hudson.core-29de547ac87619b9cd325719faab39ca9a49aa41.tar.xz
org.eclipse.hudson.core-29de547ac87619b9cd325719faab39ca9a49aa41.zip
Changes for commons-fileupload 1.3.1 in stapler 3.0.3
-rw-r--r--hudson-core/src/main/java/hudson/model/FileParameterValue.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/hudson-core/src/main/java/hudson/model/FileParameterValue.java b/hudson-core/src/main/java/hudson/model/FileParameterValue.java
index dcdd0a75..8698be1a 100644
--- a/hudson-core/src/main/java/hudson/model/FileParameterValue.java
+++ b/hudson-core/src/main/java/hudson/model/FileParameterValue.java
@@ -20,6 +20,7 @@ import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileItemHeaders;
import org.apache.commons.fileupload.disk.DiskFileItem;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.io.FilenameUtils;
@@ -36,6 +37,8 @@ import java.io.UnsupportedEncodingException;
import java.io.OutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
import javax.servlet.ServletException;
/**
@@ -179,6 +182,28 @@ public class FileParameterValue extends ParameterValue {
public static final class FileItemImpl implements FileItem {
private final File file;
+ /** FileItemHeaders with dummy initial value */
+ private FileItemHeaders headers = new FileItemHeaders() {
+ public String getHeader(String name) {
+ return null;
+ }
+ public Iterator<String> getHeaderNames() {
+ return new Iterator<String>() {
+ public boolean hasNext() {
+ return false;
+ }
+ public String next() {
+ throw new NoSuchElementException();
+ }
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+ public Iterator<String> getHeaders(String name) {
+ return getHeaderNames();
+ }
+ };
public FileItemImpl(File file) {
if (file == null) {
@@ -248,5 +273,13 @@ public class FileParameterValue extends ParameterValue {
public OutputStream getOutputStream() throws IOException {
return new FileOutputStream(file);
}
+
+ public FileItemHeaders getHeaders() {
+ return headers;
+ }
+
+ public void setHeaders(FileItemHeaders headers) {
+ this.headers = headers;
+ }
}
}

Back to the top