Skip to content

Commit

Permalink
Migrate from EE 8 to EE 9 (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil authored Feb 10, 2025
1 parent 48659f9 commit 47217d4
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 35 deletions.
18 changes: 4 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.66</version>
<version>5.7</version>
<relativePath />
</parent>
<properties>
<changelist>999999-SNAPSHOT</changelist>
<!-- https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
<jenkins.baseline>2.361</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.4</jenkins.version>
<jenkins.baseline>2.479</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.1</jenkins.version>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
</properties>
<groupId>com.sonyericsson.hudson.plugins.rebuild</groupId>
Expand Down Expand Up @@ -81,24 +81,14 @@
<!--<failsOnError>true</failsOnError>-->
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>3.0.5</version>
<configuration>
<xmlOutput>true</xmlOutput>
<!-- Optional derectory to put findbugs xdoc xml report -->
<!--<xmlOutputDirectory>target/site</xmlOutputDirectory>-->
</configuration>
</plugin>
</plugins>
</reporting>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-${jenkins.baseline}.x</artifactId>
<version>2000.v4677a_6e0ffea</version>
<version>3893.v213a_42768d35</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
28 changes: 14 additions & 14 deletions src/main/java/com/sonyericsson/rebuild/RebuildAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import hudson.ExtensionList;
import hudson.model.Action;

import javax.servlet.ServletException;
import jakarta.servlet.ServletException;

import java.io.IOException;
import java.util.ArrayList;
Expand Down Expand Up @@ -59,8 +59,8 @@
import net.sf.json.JSONNull;
import net.sf.json.JSONObject;

import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerResponse2;
import org.kohsuke.stapler.interceptor.RequirePOST;

/**
Expand Down Expand Up @@ -154,12 +154,12 @@ public boolean isRequiresPOST() {
* Handles the rebuild request and redirects to parameterized
* and non parameterized build when needed.
*
* @param request StaplerRequest the request.
* @param response StaplerResponse the response handler.
* @param request StaplerRequest2 the request.
* @param response StaplerResponse2 the response handler.
* @throws java.io.IOException in case of Stapler issues
*/
@RequirePOST
public void doIndex(StaplerRequest request, StaplerResponse response) throws IOException {
public void doIndex(StaplerRequest2 request, StaplerResponse2 response) throws IOException {
if (run != null) {
ParametersAction paramAction = run.getAction(ParametersAction.class);
if (paramAction != null) {
Expand All @@ -179,10 +179,10 @@ public void doIndex(StaplerRequest request, StaplerResponse response) throws IOE
* Handles the rebuild request with parameter.
*
* @param currentBuild the build.
* @param response StaplerResponse the response handler.
* @param response StaplerResponse2 the response handler.
* @throws IOException in case of Stapler issues
*/
public void parameterizedRebuild(Run currentBuild, StaplerResponse response) throws IOException {
public void parameterizedRebuild(Run currentBuild, StaplerResponse2 response) throws IOException {
Job project = getProject();
project.checkPermission(Item.BUILD);
if (isRebuildAvailable()) {
Expand All @@ -201,7 +201,7 @@ public void parameterizedRebuild(Run currentBuild, StaplerResponse response) thr
* @param response current response object.
* @throws IOException if something unfortunate happens.
*/
public void nonParameterizedRebuild(Run currentBuild, StaplerResponse
public void nonParameterizedRebuild(Run currentBuild, StaplerResponse2
response) throws IOException {
getProject().checkPermission(Item.BUILD);

Expand All @@ -213,12 +213,12 @@ public void nonParameterizedRebuild(Run currentBuild, StaplerResponse
/**
* Saves the form to the configuration and disk.
*
* @param req StaplerRequest
* @param rsp StaplerResponse
* @param req StaplerRequest2
* @param rsp StaplerResponse2
* @throws ServletException if something unfortunate happens.
* @throws IOException if something unfortunate happens.
*/
public void doConfigSubmit(StaplerRequest req, StaplerResponse rsp) throws ServletException, IOException {
public void doConfigSubmit(StaplerRequest2 req, StaplerResponse2 rsp) throws ServletException, IOException {
Job project = getProject();
project.checkPermission(Item.BUILD);
if (isRebuildAvailable()) {
Expand Down Expand Up @@ -319,13 +319,13 @@ private void copyRebuildDispatcherActions(Run<?, ?> fromBuild, List<Action> acti
* @param paramDefProp ParametersDefinitionProperty
* @param parameterName Name of the Parameter.
* @param paramAction ParametersAction
* @param req StaplerRequest
* @param req StaplerRequest2
* @param jo JSONObject
* @return ParameterValue instance of subclass of ParameterValue
*/
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") // see https://github.com/spotbugs/spotbugs/issues/651
public ParameterValue getParameterValue(ParametersDefinitionProperty paramDefProp,
String parameterName, ParametersAction paramAction, StaplerRequest req, JSONObject jo) {
String parameterName, ParametersAction paramAction, StaplerRequest2 req, JSONObject jo) {
ParameterDefinition paramDef;
// this is normal case when user try to rebuild a parameterized job.
if (paramDefProp != null) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/sonyericsson/rebuild/RebuildDescriptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import edu.umd.cs.findbugs.annotations.NonNull;
import jenkins.model.GlobalConfiguration;
import net.sf.json.JSONObject;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerRequest2;

/**
* This class holds the configuration values for the rebuild action.
Expand All @@ -25,7 +25,7 @@ public String getDisplayName() {
}

@Override
public boolean configure(StaplerRequest req, JSONObject formData) {
public boolean configure(StaplerRequest2 req, JSONObject formData) {
this.rebuildConfiguration.setRememberPasswordEnabled(
Boolean.parseBoolean(formData.getString("rememberPasswordEnabled")));
save();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/sonyericsson/rebuild/RebuildSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import net.sf.json.JSONObject;

import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerRequest2;

/**
*
Expand Down Expand Up @@ -91,7 +91,7 @@ public boolean isApplicable(Class<? extends Job> jobType) {
}

@Override
public JobProperty<?> newInstance(@NonNull StaplerRequest req, JSONObject formdata) {
public JobProperty<?> newInstance(@NonNull StaplerRequest2 req, JSONObject formdata) {
return req.bindJSON(RebuildSettings.class, formdata);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ THE SOFTWARE.
<j:invoke var="paramDefPro" on="${currentThread.contextClassLoader}" method="loadClass">
<j:arg value="hudson.model.ParametersDefinitionProperty"/>
</j:invoke>
<j:set var="build" value="${request.findAncestorObject(buildClass)}"/>
<j:set var="build" value="${request2.findAncestorObject(buildClass)}"/>
<j:set var="pdp" value="${build.getProject().getProperty(paramDefPro)}"/>
<j:set var="pname" value="${it.name}"/>
<j:set var="pd" value="${pdp.getParameterDefinition(pname)}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ THE SOFTWARE.
<j:invoke var="paramDefPro" on="${currentThread.contextClassLoader}" method="loadClass">
<j:arg value="hudson.model.ParametersDefinitionProperty"/>
</j:invoke>
<j:set var="build" value="${request.findAncestorObject(buildClass)}"/>
<j:set var="build" value="${request2.findAncestorObject(buildClass)}"/>
<j:set var="pdp" value="${build.parent.getProperty(paramDefPro)}"/>
<j:set var="pname" value="${it.name}"/>
<j:set var="pd" value="${pdp.getParameterDefinition(pname)}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ THE SOFTWARE.
<j:set var="rememberPasswordEnabled"
value="${it.DESCRIPTOR.rebuildConfiguration.rememberPasswordEnabled}"
scope="parent"/>
<j:set var="build" value="${request.findAncestorObject(buildClass)}"/>
<j:set var="build" value="${request2.findAncestorObject(buildClass)}"/>
<j:set var="paramAction" value="${build.getAction(parmactionClass)}"/>
<j:set var="parametersProperty"
value="${build.parent.getProperty(parametersDefinitionPropertyClass)}"/>
Expand Down

0 comments on commit 47217d4

Please sign in to comment.