Skip to content

Commit

Permalink
changing Jenkins version to 2.462 for File upload
Browse files Browse the repository at this point in the history
  • Loading branch information
abangau committed Aug 9, 2024
1 parent cee5c82 commit 04eda2a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<concurrency>1</concurrency>
<msbuild.exe>C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe</msbuild.exe>
<msbuild.configuration>Release</msbuild.configuration>
<jenkins.version>2.452.3</jenkins.version>
<jenkins.version>2.462</jenkins.version>
<maven.exec.skip>false</maven.exec.skip>
<java.level>21</java.level>
<jenkins-test-harness.version>2205.v7e19cc98f9c7</jenkins-test-harness.version> <!-- TODO newer versions than 2.55 require debugging an issue with open file handles -->
Expand Down Expand Up @@ -351,8 +351,8 @@
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.426.x</artifactId>
<version>3105.v672692894683</version>
<artifactId>bom-2.462.x</artifactId>
<version>3221.ve8f7b_fdd149d</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@
import hudson.util.IOUtils;
import jenkins.model.Jenkins;
import org.acegisecurity.AccessDeniedException;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload2.core.DiskFileItem;
import org.apache.commons.fileupload2.core.DiskFileItemFactory;
import org.apache.commons.fileupload2.core.FileItemFactory;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpStatus;
import org.apache.logging.log4j.Logger;
Expand Down Expand Up @@ -810,15 +810,25 @@ public static List<ParameterValue> createParameters(Job project, CIParameters ci
}
if (!parameterHandled) {
if (paramDef instanceof FileParameterDefinition) {
FileItemFactory fif = new DiskFileItemFactory();
FileItem fi = fif.createItem(paramDef.getName(), "text/plain", false, "");
FileItemFactory<DiskFileItem> fif = DiskFileItemFactory.builder().get();

try {
fi.getOutputStream().write(new byte[0]);

DiskFileItem fi = fif.fileItemBuilder().setFieldName(paramDef.getName()).setFormField(false)
.setContentType("text/plain").get();
try {

fi.getOutputStream().write(new byte[0]);
} catch (IOException ioe) {
logger.error("failed to create default value for file parameter '" + paramDef.getName() + "'", ioe);
}
tmpValue = new FileParameterValue(paramDef.getName(), fi);
result.add(tmpValue);
} catch (IOException ioe) {
logger.error("failed to create default value for file parameter '" + paramDef.getName() + "'", ioe);
logger.error(ioe.getMessage());
}
tmpValue = new FileParameterValue(paramDef.getName(), fi);
result.add(tmpValue);


} else {
result.add(paramDef.getDefaultParameterValue());
}
Expand Down

0 comments on commit 04eda2a

Please sign in to comment.