From 812f627cb5785048ab913e579b0661122b40a201 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Thu, 10 Oct 2024 21:25:48 -0700 Subject: [PATCH] Require Java 17 or newer; migrate to EE 9 (#231) --- pom.xml | 8 ++++---- src/main/java/hudson/matrix/Axis.java | 4 ++-- src/main/java/hudson/matrix/MatrixBuild.java | 12 ++++++------ .../hudson/matrix/MatrixConfiguration.java | 6 +++--- src/main/java/hudson/matrix/MatrixProject.java | 18 +++++++++--------- src/main/java/hudson/matrix/MatrixRun.java | 6 +++--- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/pom.xml b/pom.xml index a30ce143..22476eca 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ org.jenkins-ci.plugins plugin - 4.88 + 5.1 matrix-project @@ -15,7 +15,7 @@ 999999-SNAPSHOT jenkinsci/${project.artifactId}-plugin - 2.440.3 + 2.479 true @@ -83,8 +83,8 @@ io.jenkins.tools.bom - bom-2.440.x - 3056.v53343b_a_b_a_850 + bom-2.462.x + 3435.v238d66a_043fb_ import pom diff --git a/src/main/java/hudson/matrix/Axis.java b/src/main/java/hudson/matrix/Axis.java index 1c11711a..c536f5d1 100644 --- a/src/main/java/hudson/matrix/Axis.java +++ b/src/main/java/hudson/matrix/Axis.java @@ -33,7 +33,7 @@ import hudson.util.QuotedStringTokenizer; import org.kohsuke.accmod.Restricted; import org.kohsuke.accmod.restrictions.NoExternalUse; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import org.kohsuke.stapler.DataBoundConstructor; import java.util.ArrayList; @@ -245,7 +245,7 @@ public String getValueString() { * Parses the submitted form (where possible values are * presented as a list of checkboxes) and creates an axis */ - public static Axis parsePrefixed(StaplerRequest req, String name) { + public static Axis parsePrefixed(StaplerRequest2 req, String name) { List values = new ArrayList(); String prefix = name+'.'; diff --git a/src/main/java/hudson/matrix/MatrixBuild.java b/src/main/java/hudson/matrix/MatrixBuild.java index 0da262f0..f09b26a4 100644 --- a/src/main/java/hudson/matrix/MatrixBuild.java +++ b/src/main/java/hudson/matrix/MatrixBuild.java @@ -45,8 +45,8 @@ import org.kohsuke.accmod.Restricted; import org.kohsuke.accmod.restrictions.NoExternalUse; 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.export.Exported; import org.kohsuke.stapler.interceptor.RequirePOST; @@ -60,7 +60,7 @@ import java.util.Set; import edu.umd.cs.findbugs.annotations.CheckForNull; -import javax.servlet.ServletException; +import jakarta.servlet.ServletException; /** * Build of {@link MatrixProject}. @@ -115,7 +115,7 @@ public void delete() throws IOException { */ @RequirePOST @Deprecated - public void doDoDeleteAll( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { + public void doDoDeleteAll( StaplerRequest2 req, StaplerResponse2 rsp ) throws IOException, ServletException { doDoDelete(req, rsp); } @@ -144,7 +144,7 @@ public String getNearestRunUrl() { if (getNumber()==r.getNumber()) return getShortUrl()+'/'; else - return Stapler.getCurrentRequest().getContextPath()+'/'+r.getUrl(); + return Stapler.getCurrentRequest2().getContextPath()+'/'+r.getUrl(); } public String getShortUrl() { @@ -298,7 +298,7 @@ public boolean isPartial() { } @Override - public Object getDynamic(String token, StaplerRequest req, StaplerResponse rsp) { + public Object getDynamic(String token, StaplerRequest2 req, StaplerResponse2 rsp) { try { MatrixRun item = getRun(Combination.fromString(token)); if(item!=null) { diff --git a/src/main/java/hudson/matrix/MatrixConfiguration.java b/src/main/java/hudson/matrix/MatrixConfiguration.java index 254f4f19..f30d039c 100644 --- a/src/main/java/hudson/matrix/MatrixConfiguration.java +++ b/src/main/java/hudson/matrix/MatrixConfiguration.java @@ -66,12 +66,12 @@ import java.util.logging.Logger; import edu.umd.cs.findbugs.annotations.CheckForNull; import edu.umd.cs.findbugs.annotations.NonNull; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.kohsuke.accmod.Restricted; import org.kohsuke.accmod.restrictions.DoNotUse; import org.kohsuke.stapler.HttpResponse; -import org.kohsuke.stapler.StaplerResponse; +import org.kohsuke.stapler.StaplerResponse2; /** * One configuration of {@link MatrixProject}. @@ -552,7 +552,7 @@ public MatrixBuild getMatrixBuild() { // Hide /configure view inherited from Job @Restricted(DoNotUse.class) - public void doConfigure(StaplerResponse rsp) throws IOException { + public void doConfigure(StaplerResponse2 rsp) throws IOException { rsp.sendError(HttpServletResponse.SC_NOT_FOUND); } } diff --git a/src/main/java/hudson/matrix/MatrixProject.java b/src/main/java/hudson/matrix/MatrixProject.java index 3106961e..13841455 100644 --- a/src/main/java/hudson/matrix/MatrixProject.java +++ b/src/main/java/hudson/matrix/MatrixProject.java @@ -94,8 +94,8 @@ import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.Nullable; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletResponse; import javax.xml.transform.Source; import javax.xml.transform.TransformerException; import javax.xml.transform.stream.StreamResult; @@ -111,8 +111,8 @@ import org.kohsuke.stapler.AncestorInPath; import org.kohsuke.stapler.HttpResponse; import org.kohsuke.stapler.QueryParameter; -import org.kohsuke.stapler.StaplerRequest; -import org.kohsuke.stapler.StaplerResponse; +import org.kohsuke.stapler.StaplerRequest2; +import org.kohsuke.stapler.StaplerResponse2; import org.kohsuke.stapler.TokenList; import org.kohsuke.stapler.export.Exported; import org.xml.sax.SAXException; @@ -924,7 +924,7 @@ public MatrixProject asProject() { } @Override - public Object getDynamic(String token, StaplerRequest req, StaplerResponse rsp) { + public Object getDynamic(String token, StaplerRequest2 req, StaplerResponse2 rsp) { try { MatrixConfiguration item = getItem(token); if(item!=null) @@ -936,7 +936,7 @@ public Object getDynamic(String token, StaplerRequest req, StaplerResponse rsp) } @Override - protected void submit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, FormException { + protected void submit(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException, ServletException, FormException { super.submit(req, rsp); JSONObject json = req.getSubmittedForm(); @@ -972,7 +972,7 @@ protected void submit(StaplerRequest req, StaplerResponse rsp) throws IOExceptio } @Override - public void doConfigDotXml(StaplerRequest req, StaplerResponse rsp) throws IOException { + public void doConfigDotXml(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException { if (req.getMethod().equals("POST")) { checkPermission(CONFIGURE); File test = Files.createTempFile("test", "matrix-project.xml").toFile(); @@ -1040,7 +1040,7 @@ private void checkAxes(Iterable newAxes) throws FormException { * Also delete all the workspaces of the configuration, too. */ @Override - public HttpResponse doDoWipeOutWorkspace() throws IOException, ServletException, InterruptedException { + public HttpResponse doDoWipeOutWorkspace() throws IOException, InterruptedException { HttpResponse rsp = super.doDoWipeOutWorkspace(); for (MatrixConfiguration c : configurations.values()) c.doDoWipeOutWorkspace(); @@ -1048,7 +1048,7 @@ public HttpResponse doDoWipeOutWorkspace() throws IOException, ServletException, } @Override - public ContextMenu doChildrenContextMenu(StaplerRequest request, StaplerResponse response) throws Exception { + public ContextMenu doChildrenContextMenu(StaplerRequest2 request, StaplerResponse2 response) throws Exception { ContextMenu menu = new ContextMenu(); for (MatrixConfiguration c : getActiveConfigurations()) { menu.add(c); diff --git a/src/main/java/hudson/matrix/MatrixRun.java b/src/main/java/hudson/matrix/MatrixRun.java index 7712d5b1..48b63f63 100644 --- a/src/main/java/hudson/matrix/MatrixRun.java +++ b/src/main/java/hudson/matrix/MatrixRun.java @@ -34,7 +34,7 @@ import org.kohsuke.accmod.restrictions.NoExternalUse; import org.kohsuke.stapler.Ancestor; import org.kohsuke.stapler.Stapler; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import java.io.File; import java.io.IOException; @@ -62,7 +62,7 @@ public MatrixRun(MatrixConfiguration project, File buildDir) throws IOException @Override public String getUpUrl() { - StaplerRequest req = Stapler.getCurrentRequest(); + StaplerRequest2 req = Stapler.getCurrentRequest2(); if(req!=null) { List ancs = req.getAncestors(); for( int i=1; i ancs = req.getAncestors(); for( int i=1; i