From a2c173bcf991fe4576469eadb481823cef795d59 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Tue, 8 Oct 2024 17:39:06 -0700 Subject: [PATCH] Require Java 17 or newer; migrate to EE 9 --- pom.xml | 8 ++++---- .../plugins/credentialsbinding/impl/ZipFileBinding.java | 4 ++-- .../impl/BuildWrapperOrderCredentialsBindingTest.java | 4 ++-- .../masking/AlmquistShellSecretPatternFactoryTest.java | 3 +-- .../masking/BashSecretPatternFactoryTest.java | 3 +-- .../masking/BourneShellSecretPatternFactoryTest.java | 3 +-- .../credentialsbinding/test/CredentialsTestUtil.java | 4 ++-- 7 files changed, 13 insertions(+), 16 deletions(-) diff --git a/pom.xml b/pom.xml index 616862b2..2f584e10 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.jenkins-ci.plugins plugin - 4.88 + 5.1 @@ -17,7 +17,7 @@ https://github.com/jenkinsci/${project.artifactId}-plugin 999999-SNAPSHOT - 2.414.3 + 2.479 jenkinsci/${project.artifactId}-plugin @@ -51,8 +51,8 @@ io.jenkins.tools.bom - bom-2.414.x - 2982.vdce2153031a_0 + bom-2.462.x + 3435.v238d66a_043fb_ import pom diff --git a/src/main/java/org/jenkinsci/plugins/credentialsbinding/impl/ZipFileBinding.java b/src/main/java/org/jenkinsci/plugins/credentialsbinding/impl/ZipFileBinding.java index 86897a54..f989eea5 100644 --- a/src/main/java/org/jenkinsci/plugins/credentialsbinding/impl/ZipFileBinding.java +++ b/src/main/java/org/jenkinsci/plugins/credentialsbinding/impl/ZipFileBinding.java @@ -44,7 +44,7 @@ import org.kohsuke.stapler.AncestorInPath; import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.QueryParameter; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; public class ZipFileBinding extends AbstractOnDiskBinding { @@ -77,7 +77,7 @@ public String getDisplayName() { } // @RequirePOST - public FormValidation doCheckCredentialsId(StaplerRequest req, @AncestorInPath Item owner, @QueryParameter String value) { + public FormValidation doCheckCredentialsId(StaplerRequest2 req, @AncestorInPath Item owner, @QueryParameter String value) { //TODO due to weird behavior in c:select, there are initial calls using GET // so using this approach will prevent 405 errors if (!req.getMethod().equals("POST")) { diff --git a/src/test/java/org/jenkinsci/plugins/credentialsbinding/impl/BuildWrapperOrderCredentialsBindingTest.java b/src/test/java/org/jenkinsci/plugins/credentialsbinding/impl/BuildWrapperOrderCredentialsBindingTest.java index d43478ea..7fa780f0 100644 --- a/src/test/java/org/jenkinsci/plugins/credentialsbinding/impl/BuildWrapperOrderCredentialsBindingTest.java +++ b/src/test/java/org/jenkinsci/plugins/credentialsbinding/impl/BuildWrapperOrderCredentialsBindingTest.java @@ -48,7 +48,7 @@ import org.jvnet.hudson.test.Issue; import org.jvnet.hudson.test.JenkinsRule; import org.jvnet.hudson.test.TestExtension; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import java.io.IOException; import java.util.Collections; @@ -114,7 +114,7 @@ public boolean isApplicable(AbstractProject item) { } @Override - public BuildWrapper newInstance(StaplerRequest req, @NonNull JSONObject formData) { + public BuildWrapper newInstance(StaplerRequest2 req, @NonNull JSONObject formData) { return new BuildWrapperOrder(); } diff --git a/src/test/java/org/jenkinsci/plugins/credentialsbinding/masking/AlmquistShellSecretPatternFactoryTest.java b/src/test/java/org/jenkinsci/plugins/credentialsbinding/masking/AlmquistShellSecretPatternFactoryTest.java index ee3a0e06..3aa373bb 100644 --- a/src/test/java/org/jenkinsci/plugins/credentialsbinding/masking/AlmquistShellSecretPatternFactoryTest.java +++ b/src/test/java/org/jenkinsci/plugins/credentialsbinding/masking/AlmquistShellSecretPatternFactoryTest.java @@ -40,7 +40,6 @@ import org.junit.runner.RunWith; import org.jvnet.hudson.test.JenkinsRule; -import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Random; @@ -104,7 +103,7 @@ public static void assumeAsh() { } @Before - public void setUp() throws IOException { + public void setUp() throws Exception { j.jenkins.getDescriptorByType(Shell.DescriptorImpl.class).setShell(Executables.getPathToExecutable("ash")); project = j.createProject(WorkflowJob.class); credentialsId = UUID.randomUUID().toString(); diff --git a/src/test/java/org/jenkinsci/plugins/credentialsbinding/masking/BashSecretPatternFactoryTest.java b/src/test/java/org/jenkinsci/plugins/credentialsbinding/masking/BashSecretPatternFactoryTest.java index e9f2fa48..051d1161 100644 --- a/src/test/java/org/jenkinsci/plugins/credentialsbinding/masking/BashSecretPatternFactoryTest.java +++ b/src/test/java/org/jenkinsci/plugins/credentialsbinding/masking/BashSecretPatternFactoryTest.java @@ -40,7 +40,6 @@ import org.junit.runner.RunWith; import org.jvnet.hudson.test.JenkinsRule; -import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Random; @@ -91,7 +90,7 @@ public static void assumeBash() { } @Before - public void setUp() throws IOException { + public void setUp() throws Exception { j.jenkins.getDescriptorByType(Shell.DescriptorImpl.class).setShell(Executables.getPathToExecutable("bash")); project = j.createProject(WorkflowJob.class); credentialsId = UUID.randomUUID().toString(); diff --git a/src/test/java/org/jenkinsci/plugins/credentialsbinding/masking/BourneShellSecretPatternFactoryTest.java b/src/test/java/org/jenkinsci/plugins/credentialsbinding/masking/BourneShellSecretPatternFactoryTest.java index 8516e13a..a6c1c0dc 100644 --- a/src/test/java/org/jenkinsci/plugins/credentialsbinding/masking/BourneShellSecretPatternFactoryTest.java +++ b/src/test/java/org/jenkinsci/plugins/credentialsbinding/masking/BourneShellSecretPatternFactoryTest.java @@ -38,7 +38,6 @@ import org.junit.runner.RunWith; import org.jvnet.hudson.test.JenkinsRule; -import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Random; @@ -86,7 +85,7 @@ public static void assumeBash() { } @Before - public void setUp() throws IOException { + public void setUp() throws Exception { project = j.createProject(WorkflowJob.class); credentialsId = UUID.randomUUID().toString(); project.setDefinition(new CpsFlowDefinition( diff --git a/src/test/java/org/jenkinsci/plugins/credentialsbinding/test/CredentialsTestUtil.java b/src/test/java/org/jenkinsci/plugins/credentialsbinding/test/CredentialsTestUtil.java index 4642c942..65a7568b 100644 --- a/src/test/java/org/jenkinsci/plugins/credentialsbinding/test/CredentialsTestUtil.java +++ b/src/test/java/org/jenkinsci/plugins/credentialsbinding/test/CredentialsTestUtil.java @@ -62,7 +62,7 @@ public static void setStringCredentials(ModelObject context, String credentialsI * Registers the given value as a {@link UsernamePasswordCredentials} into the default {@link CredentialsProvider}. * Returns the generated credential id for the registered credentials. */ - public static String registerUsernamePasswordCredentials(ModelObject context, String username, String password) throws IOException { + public static String registerUsernamePasswordCredentials(ModelObject context, String username, String password) throws Exception { String credentialsId = UUID.randomUUID().toString(); setUsernamePasswordCredentials(context, credentialsId, username, password); return credentialsId; @@ -72,7 +72,7 @@ public static String registerUsernamePasswordCredentials(ModelObject context, St * Registers the given value as a {@link UsernamePasswordCredentials} into the default {@link CredentialsProvider} using the * specified credentials id. */ - public static void setUsernamePasswordCredentials(ModelObject context, String credentialsId, String username, String password) throws IOException { + public static void setUsernamePasswordCredentials(ModelObject context, String credentialsId, String username, String password) throws Exception { UsernamePasswordCredentials creds = new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, credentialsId, null, username, password); CredentialsProvider.lookupStores(context).iterator().next().addCredentials(Domain.global(), creds); }