Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require Java 17 or newer; migrate to EE 9 #231

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.88</version>
<version>5.1</version>
<relativePath />
</parent>
<artifactId>matrix-project</artifactId>
Expand All @@ -15,7 +15,7 @@
<properties>
<changelist>999999-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<jenkins.version>2.440.3</jenkins.version>
<jenkins.version>2.479</jenkins.version>
<spotbugs.skip>true</spotbugs.skip> <!-- Clean up redundant null check warnings and re-enable after SECURITY-1339 is released -->
</properties>
<licenses>
Expand Down Expand Up @@ -83,8 +83,8 @@
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.440.x</artifactId>
<version>3056.v53343b_a_b_a_850</version>
<artifactId>bom-2.462.x</artifactId>
<version>3435.v238d66a_043fb_</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/hudson/matrix/Axis.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<String> values = new ArrayList<String>();
String prefix = name+'.';

Expand Down
12 changes: 6 additions & 6 deletions src/main/java/hudson/matrix/MatrixBuild.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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}.
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/hudson/matrix/MatrixConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -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}.
Expand Down Expand Up @@ -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);
}
}
18 changes: 9 additions & 9 deletions src/main/java/hudson/matrix/MatrixProject.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -924,7 +924,7 @@
}

@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)
Expand All @@ -936,7 +936,7 @@
}

@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();
Expand Down Expand Up @@ -972,7 +972,7 @@
}

@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();
Expand Down Expand Up @@ -1040,15 +1040,15 @@
* Also delete all the workspaces of the configuration, too.
*/
@Override
public HttpResponse doDoWipeOutWorkspace() throws IOException, ServletException, InterruptedException {
public HttpResponse doDoWipeOutWorkspace() throws IOException, InterruptedException {

Check warning

Code scanning / Jenkins Security Scan

Stapler: Missing POST/RequirePOST annotation Warning

Potential CSRF vulnerability: If MatrixProject#doDoWipeOutWorkspace connects to user-specified URLs, modifies state, or is expensive to run, it should be annotated with @POST or @RequirePOST

Check warning

Code scanning / Jenkins Security Scan

Stapler: Missing permission check Warning

Potential missing permission check in MatrixProject#doDoWipeOutWorkspace
HttpResponse rsp = super.doDoWipeOutWorkspace();
for (MatrixConfiguration c : configurations.values())
c.doDoWipeOutWorkspace();
return rsp;
}

@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);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/hudson/matrix/MatrixRun.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Ancestor> ancs = req.getAncestors();
for( int i=1; i<ancs.size(); i++) {
Expand Down Expand Up @@ -98,7 +98,7 @@ public MatrixBuild getParentBuild() {

@Override
public String getDisplayName() {
StaplerRequest req = Stapler.getCurrentRequest();
StaplerRequest2 req = Stapler.getCurrentRequest2();
if(req!=null) {
List<Ancestor> ancs = req.getAncestors();
for( int i=1; i<ancs.size(); i++) {
Expand Down