diff --git a/Jenkinsfile b/Jenkinsfile index 2b3a81b7..80d60afb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,3 +1,3 @@ buildPlugin(useContainerAgent: true, configurations: [ - [ platform: 'linux', jdk: '11' ], -]) \ No newline at end of file + [ platform: 'linux', jdk: '17' ], +]) diff --git a/pom.xml b/pom.xml index 4ffc81b5..44c55556 100644 --- a/pom.xml +++ b/pom.xml @@ -16,7 +16,10 @@ 2.5.3 -SNAPSHOT - 2.375.3 + 2.475 + + 2254.vcff7a_d4969e5 + 17 3.1.1 false @@ -210,7 +213,6 @@ org.jenkins-ci.plugins parameterized-trigger test - 2.45 true @@ -277,18 +279,23 @@ org.jenkins-ci.plugins metrics - 4.2.18-439.v86a_20b_a_8318b_ io.jenkins.tools.bom - bom-2.375.x - 2179.v0884e842b_859 + bom-2.462.x + 3234.v5ca_5154341ef import pom + + + jakarta.servlet + jakarta.servlet-api + 5.0.0 + diff --git a/src/main/java/com/sonyericsson/jenkins/plugins/bfa/CauseManagement.java b/src/main/java/com/sonyericsson/jenkins/plugins/bfa/CauseManagement.java index 275711a8..9abb7cf5 100644 --- a/src/main/java/com/sonyericsson/jenkins/plugins/bfa/CauseManagement.java +++ b/src/main/java/com/sonyericsson/jenkins/plugins/bfa/CauseManagement.java @@ -42,8 +42,8 @@ import jenkins.model.Jenkins; import org.kohsuke.stapler.QueryParameter; import org.kohsuke.stapler.Stapler; -import org.kohsuke.stapler.StaplerRequest; -import org.kohsuke.stapler.StaplerResponse; +import org.kohsuke.stapler.StaplerRequest2; +import org.kohsuke.stapler.StaplerResponse2; import org.kohsuke.stapler.verb.POST; import java.io.IOException; @@ -65,7 +65,7 @@ public class CauseManagement implements RootAction { public static final String URL_NAME = "failure-cause-management"; /** * The reserved id for getting a new {@link FailureCause} from {@link #getDynamic(String, - * org.kohsuke.stapler.StaplerRequest, org.kohsuke.stapler.StaplerResponse)}. + * org.kohsuke.stapler.StaplerRequest2, org.kohsuke.stapler.StaplerResponse2)}. */ public static final String NEW_CAUSE_DYNAMIC_ID = "new"; /** @@ -167,11 +167,11 @@ public Iterable getShallowCauses() throws Exception { * Sets an error message as an attribute to the current request. * * @param message the message to set. - * @see #getErrorMessage(org.kohsuke.stapler.StaplerRequest) + * @see #getErrorMessage(org.kohsuke.stapler.StaplerRequest2) * @see #REQUEST_CAUSE_MANAGEMENT_ERROR */ private void setErrorMessage(String message) { - Stapler.getCurrentRequest().setAttribute(REQUEST_CAUSE_MANAGEMENT_ERROR, message); + Stapler.getCurrentRequest2().setAttribute(REQUEST_CAUSE_MANAGEMENT_ERROR, message); } /** @@ -180,7 +180,7 @@ private void setErrorMessage(String message) { * @param request the request where the message might be. * @return true if there is an error message to display. */ - public boolean isError(StaplerRequest request) { + public boolean isError(StaplerRequest2 request) { return Util.fixEmpty((String)request.getAttribute(REQUEST_CAUSE_MANAGEMENT_ERROR)) != null; } @@ -190,7 +190,7 @@ public boolean isError(StaplerRequest request) { * @param request the request where the message might be. * @return the error message to show. */ - public String getErrorMessage(StaplerRequest request) { + public String getErrorMessage(StaplerRequest2 request) { return (String)request.getAttribute(REQUEST_CAUSE_MANAGEMENT_ERROR); } @@ -205,7 +205,7 @@ public String getErrorMessage(StaplerRequest request) { * * @throws Exception if communication with the knowledge base failed. */ - public FailureCause getDynamic(String id, StaplerRequest request, StaplerResponse response) throws Exception { + public FailureCause getDynamic(String id, StaplerRequest2 request, StaplerResponse2 response) throws Exception { if (NEW_CAUSE_DYNAMIC_ID.equalsIgnoreCase(id)) { return new FailureCause(NEW_CAUSE_NAME, NEW_CAUSE_DESCRIPTION); } else { @@ -222,7 +222,7 @@ public FailureCause getDynamic(String id, StaplerRequest request, StaplerRespons * @throws IOException if so during redirect. */ @POST - public void doRemoveConfirm(@QueryParameter String id, StaplerRequest request, StaplerResponse response) + public void doRemoveConfirm(@QueryParameter String id, StaplerRequest2 request, StaplerResponse2 response) throws IOException { Jenkins.getInstance().checkPermission(PluginImpl.REMOVE_PERMISSION); id = Util.fixEmpty(id); diff --git a/src/main/java/com/sonyericsson/jenkins/plugins/bfa/model/FailureCause.java b/src/main/java/com/sonyericsson/jenkins/plugins/bfa/model/FailureCause.java index a1b84cee..767759d8 100644 --- a/src/main/java/com/sonyericsson/jenkins/plugins/bfa/model/FailureCause.java +++ b/src/main/java/com/sonyericsson/jenkins/plugins/bfa/model/FailureCause.java @@ -48,8 +48,8 @@ import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.QueryParameter; import org.kohsuke.stapler.Stapler; -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; import org.mongojack.Id; import org.mongojack.ObjectId; @@ -245,7 +245,7 @@ public FormValidation doCheckName(@QueryParameter final String value) { * @param response the response * @throws Exception if it fails to save to the knowledge base or a validation error occurs. */ - public synchronized void doConfigSubmit(StaplerRequest request, StaplerResponse response) + public synchronized void doConfigSubmit(StaplerRequest2 request, StaplerResponse2 response) throws Exception { logger.entering(getClass().getName(), "doConfigSubmit"); Jenkins.getInstance().checkPermission(PluginImpl.UPDATE_PERMISSION); @@ -560,14 +560,14 @@ public List getIndications() { //CS IGNORE JavadocMethod FOR NEXT 8 LINES. REASON: The exception can be thrown. /** - * Finds the {@link CauseManagement} ancestor of the {@link Stapler#getCurrentRequest() current request}. + * Finds the {@link CauseManagement} ancestor of the {@link Stapler#getCurrentRequest2() current request}. * * @return the management action or a derivative of it, or null if no management action is found. * @throws IllegalStateException if no ancestor is found. */ @JsonIgnore public CauseManagement getAncestorCauseManagement() { - StaplerRequest currentRequest = Stapler.getCurrentRequest(); + StaplerRequest2 currentRequest = Stapler.getCurrentRequest2(); if (currentRequest == null) { return null; } @@ -620,7 +620,7 @@ public static final class FailureCauseDescriptor extends Descriptor indications, List modifications) throws ServletException { JSONObject form = new JSONObject(); @@ -500,7 +500,7 @@ private StaplerRequest mockRequest(String id, String name, String description, S if (modifications != null) { form.put("modifications", modifications); } - StaplerRequest request = mock(StaplerRequest.class); + StaplerRequest2 request = mock(StaplerRequest2.class); when(request.getSubmittedForm()).thenReturn(form); when(request.bindJSONToList(same(Indication.class), any())) .thenReturn((List)indications);