diff --git a/Jenkinsfile b/Jenkinsfile index 5c2ed417e6..18900072c3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,6 +7,6 @@ buildPlugin( // we use Docker for containerized tests useContainerAgent: false, configurations: [ - [platform: 'linux', jdk: 21, jenkins: '2.462'], + [platform: 'linux', jdk: 21], [platform: 'windows', jdk: 17], ]) diff --git a/pom.xml b/pom.xml index 4c14c944fb..951930da13 100644 --- a/pom.xml +++ b/pom.xml @@ -5,13 +5,14 @@ org.jenkins-ci.plugins plugin - 4.88 + 5.1 git ${revision}${changelist} hpi + Git plugin https://github.com/${gitHubRepo} 2007 @@ -64,8 +65,11 @@ 5.5.3 -SNAPSHOT jenkinsci/${project.artifactId}-plugin - 2.440 - ${jenkins.baseline}.3 + + 2.462 + + + 2.479 false true @@ -114,6 +118,8 @@ org.jenkins-ci.plugins scm-api + + 698.v8e3b_c788f0a_6 org.jenkins-ci.plugins diff --git a/src/main/java/hudson/plugins/git/ApiTokenPropertyConfiguration.java b/src/main/java/hudson/plugins/git/ApiTokenPropertyConfiguration.java index 346b121d6e..6dfbe5eaf7 100644 --- a/src/main/java/hudson/plugins/git/ApiTokenPropertyConfiguration.java +++ b/src/main/java/hudson/plugins/git/ApiTokenPropertyConfiguration.java @@ -14,7 +14,7 @@ import org.kohsuke.accmod.Restricted; import org.kohsuke.accmod.restrictions.NoExternalUse; import org.kohsuke.stapler.HttpResponse; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import org.kohsuke.stapler.interceptor.RequirePOST; import java.io.Serializable; @@ -58,7 +58,7 @@ public GlobalConfigurationCategory getCategory() { } @RequirePOST - public HttpResponse doGenerate(StaplerRequest req) { + public HttpResponse doGenerate(StaplerRequest2 req) { Jenkins.get().checkPermission(Jenkins.ADMINISTER); String apiTokenName = req.getParameter("apiTokenName"); @@ -102,7 +102,7 @@ private static byte[] hashedBytes(byte[] tokenBytes) { } @RequirePOST - public HttpResponse doRevoke(StaplerRequest req) { + public HttpResponse doRevoke(StaplerRequest2 req) { Jenkins.get().checkPermission(Jenkins.ADMINISTER); String apiTokenUuid = req.getParameter("apiTokenUuid"); diff --git a/src/main/java/hudson/plugins/git/GitPublisher.java b/src/main/java/hudson/plugins/git/GitPublisher.java index 26728dd889..2d2cbdef88 100644 --- a/src/main/java/hudson/plugins/git/GitPublisher.java +++ b/src/main/java/hudson/plugins/git/GitPublisher.java @@ -28,7 +28,7 @@ import org.jenkinsci.plugins.gitclient.UnsupportedCommand; import org.kohsuke.stapler.*; -import javax.servlet.ServletException; +import jakarta.servlet.ServletException; import java.io.IOException; import java.io.Serializable; import java.util.ArrayList; @@ -437,7 +437,7 @@ public FormValidation doCheckNoteMsg(@QueryParameter String value) { } public FormValidation doCheckRemote( - @AncestorInPath AbstractProject project, StaplerRequest req) + @AncestorInPath AbstractProject project, StaplerRequest2 req) throws IOException, ServletException { String remote = req.getParameter("value"); boolean isMerge = req.getParameter("isMerge") != null; diff --git a/src/main/java/hudson/plugins/git/GitSCM.java b/src/main/java/hudson/plugins/git/GitSCM.java index ceab12095a..e650d9a8e5 100644 --- a/src/main/java/hudson/plugins/git/GitSCM.java +++ b/src/main/java/hudson/plugins/git/GitSCM.java @@ -66,10 +66,10 @@ import org.jenkinsci.Symbol; import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.DataBoundSetter; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import org.kohsuke.stapler.export.Exported; -import javax.servlet.ServletException; +import jakarta.servlet.ServletException; import java.io.File; import java.io.IOException; @@ -1884,7 +1884,7 @@ public static PreBuildMergeOptions createMergeOptions(UserMergeOptions mergeOpti return mergeOptions; } - public FormValidation doGitRemoteNameCheck(StaplerRequest req) + public FormValidation doGitRemoteNameCheck(StaplerRequest2 req) throws IOException, ServletException { String mergeRemoteName = req.getParameter("value"); boolean isMerge = req.getParameter("isMerge") != null; @@ -1905,7 +1905,7 @@ public FormValidation doGitRemoteNameCheck(StaplerRequest req) } @Override - public boolean configure(StaplerRequest req, JSONObject formData) throws FormException { + public boolean configure(StaplerRequest2 req, JSONObject formData) throws FormException { req.bindJSON(this, formData); save(); return true; diff --git a/src/main/java/hudson/plugins/git/GitStatus.java b/src/main/java/hudson/plugins/git/GitStatus.java index 219acb1e6d..6d3dba3c39 100644 --- a/src/main/java/hudson/plugins/git/GitStatus.java +++ b/src/main/java/hudson/plugins/git/GitStatus.java @@ -19,10 +19,10 @@ import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Pattern; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; -import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST; -import static javax.servlet.http.HttpServletResponse.SC_OK; +import static jakarta.servlet.http.HttpServletResponse.SC_BAD_REQUEST; +import static jakarta.servlet.http.HttpServletResponse.SC_OK; import jenkins.model.Jenkins; import jenkins.model.ParameterizedJobMixIn; import jenkins.scm.api.SCMEvent; @@ -180,7 +180,7 @@ public HttpResponse doNotifyCommit(HttpServletRequest request, @QueryParameter(r return new HttpResponse() { @Override - public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node) throws IOException { + public void generateResponse(StaplerRequest2 req, StaplerResponse2 rsp, Object node) throws IOException { rsp.setStatus(SC_OK); rsp.setContentType("text/plain"); for (int i = 0; i < contributors.size(); i++) { @@ -232,7 +232,7 @@ public static class ResponseContributor { * @param rsp the response. * @since 1.4.1 */ - public void addHeaders(StaplerRequest req, StaplerResponse rsp) { + public void addHeaders(StaplerRequest2 req, StaplerResponse2 rsp) { } /** @@ -243,7 +243,7 @@ public void addHeaders(StaplerRequest req, StaplerResponse rsp) { * @param w the writer. * @since 1.4.1 */ - public void writeBody(StaplerRequest req, StaplerResponse rsp, PrintWriter w) { + public void writeBody(StaplerRequest2 req, StaplerResponse2 rsp, PrintWriter w) { writeBody(w); } @@ -543,7 +543,7 @@ public PollingScheduledResponseContributor(Item project) { */ @Override @SuppressWarnings("deprecation") - public void addHeaders(StaplerRequest req, StaplerResponse rsp) { + public void addHeaders(StaplerRequest2 req, StaplerResponse2 rsp) { // Calls a deprecated getAbsoluteUrl() method because this is a remote API case // as described in the Javadoc of the deprecated getAbsoluteUrl() method. rsp.addHeader("Triggered", project.getAbsoluteUrl()); @@ -578,7 +578,7 @@ public ScheduledResponseContributor(Item project) { */ @Override @SuppressWarnings("deprecation") - public void addHeaders(StaplerRequest req, StaplerResponse rsp) { + public void addHeaders(StaplerRequest2 req, StaplerResponse2 rsp) { // Calls a deprecated getAbsoluteUrl() method because this is a remote API case // as described in the Javadoc of the deprecated getAbsoluteUrl() method. rsp.addHeader("Triggered", project.getAbsoluteUrl()); diff --git a/src/main/java/hudson/plugins/git/GitStatusCrumbExclusion.java b/src/main/java/hudson/plugins/git/GitStatusCrumbExclusion.java index 72ac266b44..169b8fb401 100644 --- a/src/main/java/hudson/plugins/git/GitStatusCrumbExclusion.java +++ b/src/main/java/hudson/plugins/git/GitStatusCrumbExclusion.java @@ -3,10 +3,10 @@ import hudson.Extension; import hudson.security.csrf.CrumbExclusion; -import javax.servlet.FilterChain; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; /** diff --git a/src/main/java/hudson/plugins/git/GitTagAction.java b/src/main/java/hudson/plugins/git/GitTagAction.java index cc31924127..9065309681 100644 --- a/src/main/java/hudson/plugins/git/GitTagAction.java +++ b/src/main/java/hudson/plugins/git/GitTagAction.java @@ -11,13 +11,13 @@ import jenkins.model.*; import org.jenkinsci.plugins.gitclient.Git; import org.jenkinsci.plugins.gitclient.GitClient; -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.export.ExportedBean; import org.kohsuke.stapler.interceptor.RequirePOST; -import javax.servlet.ServletException; +import jakarta.servlet.ServletException; import java.io.File; import java.io.IOException; import java.util.*; @@ -149,7 +149,7 @@ public String getTooltip() { * @throws ServletException on servlet error */ @RequirePOST - public synchronized void doSubmit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { + public synchronized void doSubmit(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException, ServletException { getACL().checkPermission(getPermission()); try (MultipartFormDataParser parser = new MultipartFormDataParser(req)) { diff --git a/src/main/java/hudson/plugins/git/browser/AssemblaWeb.java b/src/main/java/hudson/plugins/git/browser/AssemblaWeb.java index a9af9b07b8..e170f97d95 100644 --- a/src/main/java/hudson/plugins/git/browser/AssemblaWeb.java +++ b/src/main/java/hudson/plugins/git/browser/AssemblaWeb.java @@ -17,11 +17,11 @@ import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.interceptor.RequirePOST; import org.kohsuke.stapler.QueryParameter; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import javax.servlet.ServletException; +import jakarta.servlet.ServletException; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; @@ -98,7 +98,7 @@ public String getDisplayName() { @Override @SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE", justification = "Inherited javadoc commits that req is non-null") - public AssemblaWeb newInstance(StaplerRequest req, @NonNull JSONObject jsonObject) throws FormException { + public AssemblaWeb newInstance(StaplerRequest2 req, @NonNull JSONObject jsonObject) throws FormException { return req.bindJSON(AssemblaWeb.class, jsonObject); } diff --git a/src/main/java/hudson/plugins/git/browser/BitbucketServer.java b/src/main/java/hudson/plugins/git/browser/BitbucketServer.java index 421c642305..f88620f960 100644 --- a/src/main/java/hudson/plugins/git/browser/BitbucketServer.java +++ b/src/main/java/hudson/plugins/git/browser/BitbucketServer.java @@ -8,7 +8,7 @@ import net.sf.json.JSONObject; import org.jenkinsci.Symbol; import org.kohsuke.stapler.DataBoundConstructor; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -81,7 +81,7 @@ public String getDisplayName() { @Override @SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE", justification = "Inherited javadoc commits that req is non-null") - public BitbucketServer newInstance(StaplerRequest req, @NonNull JSONObject jsonObject) throws FormException { + public BitbucketServer newInstance(StaplerRequest2 req, @NonNull JSONObject jsonObject) throws FormException { return req.bindJSON(BitbucketServer.class, jsonObject); } } diff --git a/src/main/java/hudson/plugins/git/browser/BitbucketWeb.java b/src/main/java/hudson/plugins/git/browser/BitbucketWeb.java index d43cad8861..b633b33f3f 100644 --- a/src/main/java/hudson/plugins/git/browser/BitbucketWeb.java +++ b/src/main/java/hudson/plugins/git/browser/BitbucketWeb.java @@ -8,7 +8,7 @@ import net.sf.json.JSONObject; import org.jenkinsci.Symbol; import org.kohsuke.stapler.DataBoundConstructor; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -82,7 +82,7 @@ public String getDisplayName() { @Override @SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE", justification = "Inherited javadoc commits that req is non-null") - public BitbucketWeb newInstance(StaplerRequest req, @NonNull JSONObject jsonObject) throws FormException { + public BitbucketWeb newInstance(StaplerRequest2 req, @NonNull JSONObject jsonObject) throws FormException { return req.bindJSON(BitbucketWeb.class, jsonObject); } } diff --git a/src/main/java/hudson/plugins/git/browser/CGit.java b/src/main/java/hudson/plugins/git/browser/CGit.java index 52c31f32a0..4120f60f1b 100644 --- a/src/main/java/hudson/plugins/git/browser/CGit.java +++ b/src/main/java/hudson/plugins/git/browser/CGit.java @@ -10,7 +10,7 @@ import net.sf.json.JSONObject; import org.jenkinsci.Symbol; import org.kohsuke.stapler.DataBoundConstructor; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -92,7 +92,7 @@ public String getDisplayName() { @Override @SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE", justification = "Inherited javadoc commits that req is non-null") - public CGit newInstance(StaplerRequest req, @NonNull JSONObject jsonObject) throws FormException { + public CGit newInstance(StaplerRequest2 req, @NonNull JSONObject jsonObject) throws FormException { return req.bindJSON(CGit.class, jsonObject); } } diff --git a/src/main/java/hudson/plugins/git/browser/FisheyeGitRepositoryBrowser.java b/src/main/java/hudson/plugins/git/browser/FisheyeGitRepositoryBrowser.java index dc780d2f18..de0d3fecd4 100644 --- a/src/main/java/hudson/plugins/git/browser/FisheyeGitRepositoryBrowser.java +++ b/src/main/java/hudson/plugins/git/browser/FisheyeGitRepositoryBrowser.java @@ -14,11 +14,11 @@ import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.interceptor.RequirePOST; import org.kohsuke.stapler.QueryParameter; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import javax.servlet.ServletException; +import jakarta.servlet.ServletException; import java.io.IOException; import java.net.URL; import java.util.regex.Pattern; @@ -79,7 +79,7 @@ public String getDisplayName() { @Override @SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE", justification = "Inherited javadoc commits that req is non-null") - public FisheyeGitRepositoryBrowser newInstance(StaplerRequest req, @NonNull JSONObject jsonObject) throws FormException { + public FisheyeGitRepositoryBrowser newInstance(StaplerRequest2 req, @NonNull JSONObject jsonObject) throws FormException { return req.bindJSON(FisheyeGitRepositoryBrowser.class, jsonObject); } diff --git a/src/main/java/hudson/plugins/git/browser/GitBlitRepositoryBrowser.java b/src/main/java/hudson/plugins/git/browser/GitBlitRepositoryBrowser.java index 358339cfc4..f759411f64 100644 --- a/src/main/java/hudson/plugins/git/browser/GitBlitRepositoryBrowser.java +++ b/src/main/java/hudson/plugins/git/browser/GitBlitRepositoryBrowser.java @@ -17,11 +17,11 @@ import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.interceptor.RequirePOST; import org.kohsuke.stapler.QueryParameter; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import javax.servlet.ServletException; +import jakarta.servlet.ServletException; import java.io.IOException; import java.net.URISyntaxException; import java.net.URL; @@ -84,7 +84,7 @@ public String getDisplayName() { @Override @SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE", justification = "Inherited javadoc commits that req is non-null") - public GitBlitRepositoryBrowser newInstance(StaplerRequest req, @NonNull JSONObject jsonObject) throws FormException { + public GitBlitRepositoryBrowser newInstance(StaplerRequest2 req, @NonNull JSONObject jsonObject) throws FormException { return req.bindJSON(GitBlitRepositoryBrowser.class, jsonObject); } diff --git a/src/main/java/hudson/plugins/git/browser/GitLab.java b/src/main/java/hudson/plugins/git/browser/GitLab.java index 3ffc881127..eb26e0cee6 100644 --- a/src/main/java/hudson/plugins/git/browser/GitLab.java +++ b/src/main/java/hudson/plugins/git/browser/GitLab.java @@ -12,14 +12,14 @@ import org.jenkinsci.Symbol; import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.DataBoundSetter; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import java.io.IOException; import java.net.URL; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import javax.servlet.ServletException; +import jakarta.servlet.ServletException; import org.kohsuke.stapler.QueryParameter; @@ -145,7 +145,7 @@ public String getDisplayName() { @Override @SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE", justification = "Inherited javadoc commits that req is non-null") - public GitLab newInstance(StaplerRequest req, @NonNull JSONObject jsonObject) throws FormException { + public GitLab newInstance(StaplerRequest2 req, @NonNull JSONObject jsonObject) throws FormException { return req.bindJSON(GitLab.class, jsonObject); } diff --git a/src/main/java/hudson/plugins/git/browser/GitList.java b/src/main/java/hudson/plugins/git/browser/GitList.java index 4648f56ffd..6bf3cfd32a 100644 --- a/src/main/java/hudson/plugins/git/browser/GitList.java +++ b/src/main/java/hudson/plugins/git/browser/GitList.java @@ -10,7 +10,7 @@ import org.jenkinsci.Symbol; import org.kohsuke.stapler.DataBoundConstructor; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -94,7 +94,7 @@ public String getDisplayName() { @Override @SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE", justification = "Inherited javadoc commits that req is non-null") - public GitList newInstance(StaplerRequest req, @NonNull JSONObject jsonObject) throws FormException { + public GitList newInstance(StaplerRequest2 req, @NonNull JSONObject jsonObject) throws FormException { return req.bindJSON(GitList.class, jsonObject); } } diff --git a/src/main/java/hudson/plugins/git/browser/GitRepositoryBrowser.java b/src/main/java/hudson/plugins/git/browser/GitRepositoryBrowser.java index 814d8ce19d..52f441c3f1 100644 --- a/src/main/java/hudson/plugins/git/browser/GitRepositoryBrowser.java +++ b/src/main/java/hudson/plugins/git/browser/GitRepositoryBrowser.java @@ -9,7 +9,7 @@ import hudson.scm.RepositoryBrowser; import org.kohsuke.stapler.Stapler; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import java.io.IOException; import java.net.IDN; @@ -46,7 +46,7 @@ public final String getRepoUrl() { public final URL getUrl() throws IOException { String u = url; - StaplerRequest req = Stapler.getCurrentRequest(); + StaplerRequest2 req = Stapler.getCurrentRequest2(); if (req != null) { Job job = req.findAncestorObject(Job.class); if (job != null) { diff --git a/src/main/java/hudson/plugins/git/browser/GitWeb.java b/src/main/java/hudson/plugins/git/browser/GitWeb.java index 6f6b232a31..a0862ec2fc 100644 --- a/src/main/java/hudson/plugins/git/browser/GitWeb.java +++ b/src/main/java/hudson/plugins/git/browser/GitWeb.java @@ -10,7 +10,7 @@ import net.sf.json.JSONObject; import org.jenkinsci.Symbol; import org.kohsuke.stapler.DataBoundConstructor; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -94,7 +94,7 @@ public String getDisplayName() { @Override @SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE", justification = "Inherited javadoc commits that req is non-null") - public GitWeb newInstance(StaplerRequest req, @NonNull JSONObject jsonObject) throws FormException { + public GitWeb newInstance(StaplerRequest2 req, @NonNull JSONObject jsonObject) throws FormException { return req.bindJSON(GitWeb.class, jsonObject); } } diff --git a/src/main/java/hudson/plugins/git/browser/GithubWeb.java b/src/main/java/hudson/plugins/git/browser/GithubWeb.java index 50b4f00132..6d525d3e75 100644 --- a/src/main/java/hudson/plugins/git/browser/GithubWeb.java +++ b/src/main/java/hudson/plugins/git/browser/GithubWeb.java @@ -10,7 +10,7 @@ import org.jenkinsci.Symbol; import org.kohsuke.stapler.DataBoundConstructor; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -100,7 +100,7 @@ public String getDisplayName() { @Override @SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE", justification = "Inherited javadoc commits that req is non-null") - public GithubWeb newInstance(StaplerRequest req, @NonNull JSONObject jsonObject) throws FormException { + public GithubWeb newInstance(StaplerRequest2 req, @NonNull JSONObject jsonObject) throws FormException { return req.bindJSON(GithubWeb.class, jsonObject); } } diff --git a/src/main/java/hudson/plugins/git/browser/Gitiles.java b/src/main/java/hudson/plugins/git/browser/Gitiles.java index 7e6156d63b..f77251e204 100644 --- a/src/main/java/hudson/plugins/git/browser/Gitiles.java +++ b/src/main/java/hudson/plugins/git/browser/Gitiles.java @@ -17,7 +17,7 @@ import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import javax.servlet.ServletException; +import jakarta.servlet.ServletException; import net.sf.json.JSONObject; @@ -26,7 +26,7 @@ import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.interceptor.RequirePOST; import org.kohsuke.stapler.QueryParameter; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; /** * @author Manolo Carrasco MoƱino @@ -72,7 +72,7 @@ public String getDisplayName() { @Override @SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE", justification = "Inherited javadoc commits that req is non-null") - public Gitiles newInstance(StaplerRequest req, @NonNull JSONObject jsonObject) throws FormException { + public Gitiles newInstance(StaplerRequest2 req, @NonNull JSONObject jsonObject) throws FormException { return req.bindJSON(Gitiles.class, jsonObject); } diff --git a/src/main/java/hudson/plugins/git/browser/GitoriousWeb.java b/src/main/java/hudson/plugins/git/browser/GitoriousWeb.java index b9faa07be4..1b728c523c 100644 --- a/src/main/java/hudson/plugins/git/browser/GitoriousWeb.java +++ b/src/main/java/hudson/plugins/git/browser/GitoriousWeb.java @@ -8,7 +8,7 @@ import hudson.scm.RepositoryBrowser; import net.sf.json.JSONObject; import org.kohsuke.stapler.DataBoundConstructor; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -76,7 +76,7 @@ public String getDisplayName() { @Override @SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE", justification = "Inherited javadoc commits that req is non-null") - public GitoriousWeb newInstance(StaplerRequest req, @NonNull JSONObject jsonObject) throws FormException { + public GitoriousWeb newInstance(StaplerRequest2 req, @NonNull JSONObject jsonObject) throws FormException { return req.bindJSON(GitoriousWeb.class, jsonObject); } } diff --git a/src/main/java/hudson/plugins/git/browser/GogsGit.java b/src/main/java/hudson/plugins/git/browser/GogsGit.java index 0e5f31008a..fefa6de35b 100644 --- a/src/main/java/hudson/plugins/git/browser/GogsGit.java +++ b/src/main/java/hudson/plugins/git/browser/GogsGit.java @@ -10,7 +10,7 @@ import org.jenkinsci.Symbol; import org.kohsuke.stapler.DataBoundConstructor; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -102,7 +102,7 @@ public String getDisplayName() { @Override @SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE", justification = "Inherited javadoc commits that req is non-null") - public GogsGit newInstance(StaplerRequest req, @NonNull JSONObject jsonObject) throws FormException { + public GogsGit newInstance(StaplerRequest2 req, @NonNull JSONObject jsonObject) throws FormException { return req.bindJSON(GogsGit.class, jsonObject); } } diff --git a/src/main/java/hudson/plugins/git/browser/KilnGit.java b/src/main/java/hudson/plugins/git/browser/KilnGit.java index 53d879c13d..5bcece4fc8 100644 --- a/src/main/java/hudson/plugins/git/browser/KilnGit.java +++ b/src/main/java/hudson/plugins/git/browser/KilnGit.java @@ -11,7 +11,7 @@ import org.jenkinsci.Symbol; import org.kohsuke.stapler.DataBoundConstructor; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -113,7 +113,7 @@ public String getDisplayName() { @Override @SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE", justification = "Inherited javadoc commits that req is non-null") - public KilnGit newInstance(StaplerRequest req, @NonNull JSONObject jsonObject) throws FormException { + public KilnGit newInstance(StaplerRequest2 req, @NonNull JSONObject jsonObject) throws FormException { return req.bindJSON(KilnGit.class, jsonObject); } } diff --git a/src/main/java/hudson/plugins/git/browser/Phabricator.java b/src/main/java/hudson/plugins/git/browser/Phabricator.java index fd18751715..c511db55be 100644 --- a/src/main/java/hudson/plugins/git/browser/Phabricator.java +++ b/src/main/java/hudson/plugins/git/browser/Phabricator.java @@ -8,7 +8,7 @@ import net.sf.json.JSONObject; import org.jenkinsci.Symbol; import org.kohsuke.stapler.DataBoundConstructor; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -92,7 +92,7 @@ public String getDisplayName() { @Override @SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE", justification = "Inherited javadoc commits that req is non-null") - public Phabricator newInstance(StaplerRequest req, @NonNull JSONObject jsonObject) throws FormException { + public Phabricator newInstance(StaplerRequest2 req, @NonNull JSONObject jsonObject) throws FormException { return req.bindJSON(Phabricator.class, jsonObject); } } diff --git a/src/main/java/hudson/plugins/git/browser/RedmineWeb.java b/src/main/java/hudson/plugins/git/browser/RedmineWeb.java index 5820fac961..5106f56fe1 100644 --- a/src/main/java/hudson/plugins/git/browser/RedmineWeb.java +++ b/src/main/java/hudson/plugins/git/browser/RedmineWeb.java @@ -9,7 +9,7 @@ import net.sf.json.JSONObject; import org.jenkinsci.Symbol; import org.kohsuke.stapler.DataBoundConstructor; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -95,7 +95,7 @@ public String getDisplayName() { @Override @SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE", justification = "Inherited javadoc commits that req is non-null") - public RedmineWeb newInstance(StaplerRequest req, @NonNull JSONObject jsonObject) throws FormException { + public RedmineWeb newInstance(StaplerRequest2 req, @NonNull JSONObject jsonObject) throws FormException { return req.bindJSON(RedmineWeb.class, jsonObject); } } diff --git a/src/main/java/hudson/plugins/git/browser/RhodeCode.java b/src/main/java/hudson/plugins/git/browser/RhodeCode.java index 73356106d6..fc11d50fe4 100644 --- a/src/main/java/hudson/plugins/git/browser/RhodeCode.java +++ b/src/main/java/hudson/plugins/git/browser/RhodeCode.java @@ -10,7 +10,7 @@ import net.sf.json.JSONObject; import org.jenkinsci.Symbol; import org.kohsuke.stapler.DataBoundConstructor; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -97,7 +97,7 @@ public String getDisplayName() { @Override @SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE", justification = "Inherited javadoc commits that req is non-null") - public RhodeCode newInstance(StaplerRequest req, @NonNull JSONObject jsonObject) throws FormException { + public RhodeCode newInstance(StaplerRequest2 req, @NonNull JSONObject jsonObject) throws FormException { return req.bindJSON(RhodeCode.class, jsonObject); } } diff --git a/src/main/java/hudson/plugins/git/browser/Stash.java b/src/main/java/hudson/plugins/git/browser/Stash.java index b4fa048690..71942b227c 100644 --- a/src/main/java/hudson/plugins/git/browser/Stash.java +++ b/src/main/java/hudson/plugins/git/browser/Stash.java @@ -9,7 +9,7 @@ import hudson.scm.browsers.QueryBuilder; import net.sf.json.JSONObject; import org.kohsuke.stapler.DataBoundConstructor; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -97,7 +97,7 @@ public String getDisplayName() { @Override @SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE", justification = "Inherited javadoc commits that req is non-null") - public Stash newInstance(StaplerRequest req, @NonNull JSONObject jsonObject) throws FormException { + public Stash newInstance(StaplerRequest2 req, @NonNull JSONObject jsonObject) throws FormException { return req.bindJSON(Stash.class, jsonObject); } } diff --git a/src/main/java/hudson/plugins/git/browser/TFS2013GitRepositoryBrowser.java b/src/main/java/hudson/plugins/git/browser/TFS2013GitRepositoryBrowser.java index 89f99be3d9..fda7468d07 100644 --- a/src/main/java/hudson/plugins/git/browser/TFS2013GitRepositoryBrowser.java +++ b/src/main/java/hudson/plugins/git/browser/TFS2013GitRepositoryBrowser.java @@ -16,11 +16,11 @@ import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.interceptor.RequirePOST; import org.kohsuke.stapler.QueryParameter; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import javax.servlet.ServletException; +import jakarta.servlet.ServletException; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; @@ -95,7 +95,7 @@ public String getDisplayName() { @Override @SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE", justification = "Inherited javadoc commits that req is non-null") - public TFS2013GitRepositoryBrowser newInstance(StaplerRequest req, @NonNull JSONObject jsonObject) throws FormException { + public TFS2013GitRepositoryBrowser newInstance(StaplerRequest2 req, @NonNull JSONObject jsonObject) throws FormException { try { req.getSubmittedForm(); } catch (ServletException e) { diff --git a/src/main/java/hudson/plugins/git/browser/ViewGitWeb.java b/src/main/java/hudson/plugins/git/browser/ViewGitWeb.java index 27bf8bdc33..f5ec81299d 100644 --- a/src/main/java/hudson/plugins/git/browser/ViewGitWeb.java +++ b/src/main/java/hudson/plugins/git/browser/ViewGitWeb.java @@ -18,11 +18,11 @@ import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.interceptor.RequirePOST; import org.kohsuke.stapler.QueryParameter; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import javax.servlet.ServletException; +import jakarta.servlet.ServletException; import java.io.IOException; import java.net.URISyntaxException; import java.net.URL; @@ -91,7 +91,7 @@ public String getDisplayName() { @Override @SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE", justification = "Inherited javadoc commits that req is non-null") - public ViewGitWeb newInstance(StaplerRequest req, @NonNull JSONObject jsonObject) throws FormException { + public ViewGitWeb newInstance(StaplerRequest2 req, @NonNull JSONObject jsonObject) throws FormException { return req.bindJSON(ViewGitWeb.class, jsonObject); } diff --git a/src/main/java/hudson/plugins/git/extensions/impl/PruneStaleTag.java b/src/main/java/hudson/plugins/git/extensions/impl/PruneStaleTag.java index 70815d5dbe..a50e92528c 100644 --- a/src/main/java/hudson/plugins/git/extensions/impl/PruneStaleTag.java +++ b/src/main/java/hudson/plugins/git/extensions/impl/PruneStaleTag.java @@ -47,7 +47,7 @@ import org.jenkinsci.plugins.gitclient.FetchCommand; import org.jenkinsci.plugins.gitclient.GitClient; import org.kohsuke.stapler.DataBoundConstructor; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; /** * Prune stale local tags that do not exist on any remote. @@ -166,7 +166,7 @@ public String toString() { public static class DescriptorImpl extends GitSCMExtensionDescriptor { @Override - public GitSCMExtension newInstance(StaplerRequest req, JSONObject formData) throws FormException { + public GitSCMExtension newInstance(StaplerRequest2 req, JSONObject formData) throws FormException { return new PruneStaleTag(true); } diff --git a/src/main/java/hudson/plugins/git/util/BuildData.java b/src/main/java/hudson/plugins/git/util/BuildData.java index ba4cb6d783..de9c1c8c63 100644 --- a/src/main/java/hudson/plugins/git/util/BuildData.java +++ b/src/main/java/hudson/plugins/git/util/BuildData.java @@ -21,7 +21,7 @@ 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.StaplerRequest2; import org.kohsuke.stapler.export.Exported; import org.kohsuke.stapler.export.ExportedBean; @@ -141,7 +141,7 @@ public Integer getIndex() { @Restricted(NoExternalUse.class) // only used from stapler/jelly @CheckForNull public Run getOwningRun() { - StaplerRequest req = Stapler.getCurrentRequest(); + StaplerRequest2 req = Stapler.getCurrentRequest2(); if (req == null) { return null; } diff --git a/src/main/java/jenkins/plugins/git/GitSCMSource.java b/src/main/java/jenkins/plugins/git/GitSCMSource.java index 536b845b38..a18116b5b1 100644 --- a/src/main/java/jenkins/plugins/git/GitSCMSource.java +++ b/src/main/java/jenkins/plugins/git/GitSCMSource.java @@ -107,8 +107,8 @@ import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.DataBoundSetter; 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.interceptor.RequirePOST; /** @@ -671,7 +671,7 @@ public boolean isMatch(@NonNull SCM scm) { result.add(new GitStatus.ResponseContributor() { @Override @SuppressWarnings("deprecation") - public void addHeaders(StaplerRequest req, StaplerResponse rsp) { + public void addHeaders(StaplerRequest2 req, StaplerResponse2 rsp) { // Calls a deprecated getAbsoluteUrl() method because this is a remote API case // as described in the Javadoc of the deprecated getAbsoluteUrl() method. rsp.addHeader("Triggered", owner.getAbsoluteUrl()); diff --git a/src/test/java/hudson/plugins/git/GitStatusTest.java b/src/test/java/hudson/plugins/git/GitStatusTest.java index ce0a133867..64637ccd8b 100644 --- a/src/test/java/hudson/plugins/git/GitStatusTest.java +++ b/src/test/java/hudson/plugins/git/GitStatusTest.java @@ -33,10 +33,10 @@ import org.junit.Test; import org.jvnet.hudson.test.Issue; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.kohsuke.stapler.HttpResponse; -import org.kohsuke.stapler.StaplerRequest; -import org.kohsuke.stapler.StaplerResponse; +import org.kohsuke.stapler.StaplerRequest2; +import org.kohsuke.stapler.StaplerResponse2; public class GitStatusTest extends AbstractGitProject { @@ -536,8 +536,8 @@ public void testDoNotifyCommitTriggeredHeadersLimited() throws Exception { HttpResponse rsp = this.gitStatus.doNotifyCommit(requestWithNoParameter, "a", "master", null, notifyCommitApiToken); // Up to 10 "Triggered" headers + 1 extra warning are returned. - StaplerRequest sReq = mock(StaplerRequest.class); - StaplerResponse sRsp = mock(StaplerResponse.class); + StaplerRequest2 sReq = mock(StaplerRequest2.class); + StaplerResponse2 sRsp = mock(StaplerResponse2.class); Mockito.when(sRsp.getWriter()).thenReturn(mock(PrintWriter.class)); rsp.generateResponse(sReq, sRsp, null); Mockito.verify(sRsp, Mockito.times(11)).addHeader(Mockito.eq("Triggered"), Mockito.anyString()); diff --git a/src/test/java/hudson/plugins/git/GitStatusTheoriesTest.java b/src/test/java/hudson/plugins/git/GitStatusTheoriesTest.java index cf9ce2af1d..42a2a03fac 100644 --- a/src/test/java/hudson/plugins/git/GitStatusTheoriesTest.java +++ b/src/test/java/hudson/plugins/git/GitStatusTheoriesTest.java @@ -21,7 +21,7 @@ import org.junit.experimental.theories.Theory; import org.junit.runner.RunWith; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; @RunWith(Theories.class) public class GitStatusTheoriesTest extends AbstractGitProject { diff --git a/src/test/java/hudson/plugins/git/GitTagActionTest.java b/src/test/java/hudson/plugins/git/GitTagActionTest.java index de424fbc8f..3623053407 100644 --- a/src/test/java/hudson/plugins/git/GitTagActionTest.java +++ b/src/test/java/hudson/plugins/git/GitTagActionTest.java @@ -48,7 +48,7 @@ import org.jvnet.hudson.test.JenkinsRule; import org.jvnet.hudson.test.TestExtension; -import javax.servlet.ServletException; +import jakarta.servlet.ServletException; /** * Test git tag action. Low value test that was created as part of diff --git a/src/test/java/jenkins/plugins/git/GitSCMSourceTest.java b/src/test/java/jenkins/plugins/git/GitSCMSourceTest.java index 40efa21490..df9b80c75e 100644 --- a/src/test/java/jenkins/plugins/git/GitSCMSourceTest.java +++ b/src/test/java/jenkins/plugins/git/GitSCMSourceTest.java @@ -49,7 +49,7 @@ import org.jvnet.hudson.test.Issue; import org.jvnet.hudson.test.JenkinsRule; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import java.io.IOException; import java.util.Collections; import org.jvnet.hudson.test.TestExtension;