Skip to content

Commit 8d4bec2

Browse files
authored
Merge branch 'master' into JENKINS-73791
2 parents 5bf5cad + 611ea6a commit 8d4bec2

12 files changed

+38
-33
lines changed

pom.xml

+6-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.jenkins-ci.plugins</groupId>
66
<artifactId>plugin</artifactId>
7-
<version>4.88</version>
7+
<version>5.9</version>
88
<relativePath />
99
</parent>
1010

@@ -33,7 +33,9 @@
3333
<changelist>999999-SNAPSHOT</changelist>
3434
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
3535
<hpi.compatibleSinceVersion>2.2.0</hpi.compatibleSinceVersion>
36-
<jenkins.version>2.440.3</jenkins.version>
36+
<!-- https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
37+
<jenkins.baseline>2.479</jenkins.baseline>
38+
<jenkins.version>${jenkins.baseline}.1</jenkins.version>
3739
<useBeta>true</useBeta>
3840
<spotless.check.skip>false</spotless.check.skip>
3941
</properties>
@@ -42,8 +44,8 @@
4244
<dependencies>
4345
<dependency>
4446
<groupId>io.jenkins.tools.bom</groupId>
45-
<artifactId>bom-2.440.x</artifactId>
46-
<version>3234.v5ca_5154341ef</version>
47+
<artifactId>bom-${jenkins.baseline}.x</artifactId>
48+
<version>3893.v213a_42768d35</version>
4749
<type>pom</type>
4850
<scope>import</scope>
4951
</dependency>

src/main/java/org/jenkinsci/plugins/github_branch_source/ApiRateLimitChecker.java

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.jenkinsci.plugins.github_branch_source;
22

33
import edu.umd.cs.findbugs.annotations.NonNull;
4-
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
54
import hudson.Util;
65
import hudson.model.TaskListener;
76
import hudson.util.LogTaskListener;
@@ -18,7 +17,6 @@
1817
import org.kohsuke.github.GitHub;
1918
import org.kohsuke.github.RateLimitChecker;
2019

21-
@SuppressFBWarnings("DMI_RANDOM_USED_ONLY_ONCE") // https://github.com/spotbugs/spotbugs/issues/1539
2220
public enum ApiRateLimitChecker {
2321

2422
/** Attempt to evenly distribute GitHub API requests. */

src/main/java/org/jenkinsci/plugins/github_branch_source/FillErrorResponse.java

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
package org.jenkinsci.plugins.github_branch_source;
22

33
import hudson.Util;
4+
import jakarta.servlet.http.HttpServletResponse;
45
import java.io.IOException;
5-
import javax.servlet.ServletException;
6-
import javax.servlet.http.HttpServletResponse;
76
import jenkins.model.Jenkins;
87
import org.kohsuke.stapler.HttpResponse;
9-
import org.kohsuke.stapler.StaplerRequest;
10-
import org.kohsuke.stapler.StaplerResponse;
8+
import org.kohsuke.stapler.StaplerRequest2;
9+
import org.kohsuke.stapler.StaplerResponse2;
1110

1211
// TODO replace with corresponding core functionality once Jenkins core has JENKINS-42443
1312
class FillErrorResponse extends IOException implements HttpResponse {
@@ -20,8 +19,7 @@ public FillErrorResponse(String message, boolean clearList) {
2019
}
2120

2221
@Override
23-
public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node)
24-
throws IOException, ServletException {
22+
public void generateResponse(StaplerRequest2 req, StaplerResponse2 rsp, Object node) throws IOException {
2523
rsp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
2624
rsp.setContentType("text/html;charset=UTF-8");
2725
rsp.setHeader("X-Jenkins-Select-Error", clearList ? "clear" : "retain");

src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubAppCredentials.java

-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ public class GitHubAppCredentials extends BaseStandardCredentials implements Sta
8282

8383
private String apiUri;
8484

85-
@SuppressFBWarnings(value = "IS2_INCONSISTENT_SYNC", justification = "#withOwner locking only for #byOwner")
8685
private String owner;
8786

8887
private transient AppInstallationToken cachedToken;

src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubConfiguration.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
import jenkins.model.Jenkins;
4343
import net.sf.json.JSONObject;
4444
import org.apache.commons.lang.StringUtils;
45-
import org.kohsuke.stapler.StaplerRequest;
45+
import org.kohsuke.stapler.StaplerRequest2;
4646

4747
@Extension
4848
public class GitHubConfiguration extends GlobalConfiguration {
@@ -60,7 +60,7 @@ public GitHubConfiguration() {
6060
}
6161

6262
@Override
63-
public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
63+
public boolean configure(StaplerRequest2 req, JSONObject json) throws FormException {
6464
req.bindJSON(this, json);
6565
return true;
6666
}

src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubOrgMetadataAction.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public String getAvatarImageOf(String size) {
7676
String image = avatarIconClassNameImageOf(getAvatarIconClassName(), size);
7777
return image != null
7878
? image
79-
: (Stapler.getCurrentRequest().getContextPath()
79+
: (Stapler.getCurrentRequest2().getContextPath()
8080
+ Hudson.RESOURCE_PATH
8181
+ "/plugin/github-branch-source/images/"
8282
+ "/github-logo.svg");

src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMBuilder.java

-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import com.cloudbees.plugins.credentials.domains.URIRequirementBuilder;
3333
import edu.umd.cs.findbugs.annotations.CheckForNull;
3434
import edu.umd.cs.findbugs.annotations.NonNull;
35-
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
3635
import hudson.model.Item;
3736
import hudson.model.Queue;
3837
import hudson.plugins.git.GitSCM;
@@ -59,7 +58,6 @@
5958
*
6059
* @since 2.2.0
6160
*/
62-
@SuppressFBWarnings("DMI_RANDOM_USED_ONLY_ONCE") // https://github.com/spotbugs/spotbugs/issues/1539
6361
public class GitHubSCMBuilder extends GitSCMBuilder<GitHubSCMBuilder> {
6462

6563
private static final Random ENTROPY = new Random();

src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSource.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
import hudson.util.FormValidation;
5959
import hudson.util.ListBoxModel;
6060
import hudson.util.LogTaskListener;
61+
import jakarta.servlet.http.HttpServletResponse;
6162
import java.io.Closeable;
6263
import java.io.FileNotFoundException;
6364
import java.io.IOException;
@@ -85,7 +86,6 @@
8586
import java.util.logging.Logger;
8687
import java.util.regex.Matcher;
8788
import java.util.regex.Pattern;
88-
import javax.servlet.http.HttpServletResponse;
8989
import jenkins.model.Jenkins;
9090
import jenkins.plugins.git.AbstractGitSCMSource;
9191
import jenkins.plugins.git.GitTagSCMRevision;

src/main/java/org/jenkinsci/plugins/github_branch_source/PullRequestSCMRevision.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public PullRequestSCMRevision(
5858
this.mergeHash = mergeHash;
5959
}
6060

61-
@SuppressFBWarnings({"SE_PRIVATE_READ_RESOLVE_NOT_INHERITED", "RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"})
61+
@SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE")
6262
private Object readResolve() {
6363
if (getTarget() == null) {
6464
// fix an instance prior to the type migration, thankfully we have all the required info

src/test/java/org/jenkinsci/plugins/github_branch_source/EndpointTest.java

+10-10
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
import hudson.Util;
1111
import hudson.model.UnprotectedRootAction;
1212
import hudson.security.csrf.CrumbExclusion;
13+
import jakarta.servlet.FilterChain;
14+
import jakarta.servlet.ServletException;
15+
import jakarta.servlet.http.HttpServletRequest;
16+
import jakarta.servlet.http.HttpServletResponse;
1317
import java.io.IOException;
1418
import java.net.URL;
1519
import java.util.Arrays;
16-
import javax.servlet.FilterChain;
17-
import javax.servlet.ServletException;
18-
import javax.servlet.http.HttpServletRequest;
19-
import javax.servlet.http.HttpServletResponse;
2020
import jenkins.model.Jenkins;
2121
import org.htmlunit.FailingHttpStatusCodeException;
2222
import org.htmlunit.HttpMethod;
@@ -31,8 +31,8 @@
3131
import org.jvnet.hudson.test.JenkinsRule;
3232
import org.jvnet.hudson.test.MockAuthorizationStrategy;
3333
import org.jvnet.hudson.test.TestExtension;
34-
import org.kohsuke.stapler.StaplerRequest;
35-
import org.kohsuke.stapler.StaplerResponse;
34+
import org.kohsuke.stapler.StaplerRequest2;
35+
import org.kohsuke.stapler.StaplerResponse2;
3636
import org.xml.sax.SAXException;
3737

3838
public class EndpointTest {
@@ -103,7 +103,7 @@ private String appendCrumb(String url) {
103103
}
104104

105105
private String getCrumb() {
106-
return Functions.getCrumbRequestField() + "=" + Functions.getCrumb(null);
106+
return Functions.getCrumbRequestField() + "=" + Functions.getCrumb((StaplerRequest2) null);
107107
}
108108

109109
private Page post(String relative, String userName) throws Exception {
@@ -116,8 +116,8 @@ private Page post(String relative, String userName) throws Exception {
116116

117117
final WebRequest request = new WebRequest(new URL(client.getContextPath() + relative), HttpMethod.POST);
118118
request.setAdditionalHeader("Accept", client.getBrowserVersion().getHtmlAcceptHeader());
119-
request.setRequestParameters(
120-
Arrays.asList(new NameValuePair(Functions.getCrumbRequestField(), Functions.getCrumb(null))));
119+
request.setRequestParameters(Arrays.asList(
120+
new NameValuePair(Functions.getCrumbRequestField(), Functions.getCrumb((StaplerRequest2) null))));
121121
return client.getPage(request);
122122
}
123123

@@ -141,7 +141,7 @@ public String getUrlName() {
141141
return "testroot";
142142
}
143143

144-
public void doIndex(StaplerRequest request, StaplerResponse response) throws IOException {
144+
public void doIndex(StaplerRequest2 request, StaplerResponse2 response) throws IOException {
145145
visited = true;
146146
response.getWriter().println("OK");
147147
}

src/test/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMBuilderTest.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.cloudbees.plugins.credentials.SystemCredentialsProvider;
2121
import com.cloudbees.plugins.credentials.domains.Domain;
2222
import com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl;
23+
import hudson.model.Descriptor;
2324
import hudson.plugins.git.GitSCM;
2425
import hudson.plugins.git.Revision;
2526
import hudson.plugins.git.UserRemoteConfig;
@@ -82,7 +83,7 @@ public void createGitHubSCMSourceForTest(boolean configuredByUrl, String repoUrl
8283
}
8384

8485
@Before
85-
public void setUp() throws IOException {
86+
public void setUp() throws IOException, Descriptor.FormException {
8687
owner = j.createProject(WorkflowMultiBranchProject.class);
8788
Credentials userPasswordCredential = new UsernamePasswordCredentialsImpl(
8889
CredentialsScope.GLOBAL, "user-pass", null, "git-user", "git-secret");

src/test/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMNavigatorTest.java

+11-2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl;
3838
import edu.umd.cs.findbugs.annotations.NonNull;
3939
import edu.umd.cs.findbugs.annotations.Nullable;
40+
import hudson.model.Descriptor;
4041
import hudson.model.Item;
4142
import hudson.model.TaskListener;
4243
import hudson.model.User;
@@ -75,8 +76,16 @@ public class GitHubSCMNavigatorTest extends AbstractGitHubWireMockTest {
7576
@Mock
7677
private SCMSourceOwner scmSourceOwner;
7778

78-
private BaseStandardCredentials credentials = new UsernamePasswordCredentialsImpl(
79-
CredentialsScope.GLOBAL, "authenticated-user", null, "git-user", "git-secret");
79+
private BaseStandardCredentials credentials;
80+
81+
{
82+
try {
83+
credentials = new UsernamePasswordCredentialsImpl(
84+
CredentialsScope.GLOBAL, "authenticated-user", null, "git-user", "git-secret");
85+
} catch (Descriptor.FormException e) {
86+
throw new RuntimeException(e);
87+
}
88+
}
8089

8190
private GitHubSCMNavigator navigator;
8291

0 commit comments

Comments
 (0)