Skip to content

Commit ee78420

Browse files
authored
Merge pull request #624 from jenkinsci/feat/bump-lts-to-2_249-cleansed-history
Bump LTS to 2.479.x line
2 parents 8031891 + f15c014 commit ee78420

File tree

9 files changed

+65
-61
lines changed

9 files changed

+65
-61
lines changed

Jenkinsfile

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ buildPlugin(
66
forkCount: '1C', // run this number of tests in parallel for faster feedback. If the number terminates with a 'C', the value will be multiplied by the number of available CPU cores
77
useContainerAgent: true, // Set to `false` if you need to use Docker for containerized tests
88
configurations: [
9+
[platform: 'linux', jdk: 17],
910
[platform: 'linux', jdk: 21],
1011
[platform: 'windows', jdk: 17],
1112
])

pom.xml

+10-10
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.86</version>
7+
<version>5.4</version>
88
<relativePath />
99
</parent>
1010

@@ -52,17 +52,18 @@
5252
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
5353
<jira-rest-client.version>5.2.7</jira-rest-client.version>
5454
<fugue.version>4.7.2</fugue.version>
55-
<!-- jenkins -->
56-
<jenkins.version>2.440.3</jenkins.version>
55+
<!-- https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
56+
<jenkins.baseline>2.479</jenkins.baseline>
57+
<jenkins.version>${jenkins.baseline}.3</jenkins.version>
5758
<spotless.check.skip>false</spotless.check.skip>
5859
</properties>
5960

6061
<dependencyManagement>
6162
<dependencies>
6263
<dependency>
6364
<groupId>io.jenkins.tools.bom</groupId>
64-
<artifactId>bom-2.440.x</artifactId>
65-
<version>3234.v5ca_5154341ef</version>
65+
<artifactId>bom-${jenkins.baseline}.x</artifactId>
66+
<version>3875.v1df09947cde6</version>
6667
<type>pom</type>
6768
<scope>import</scope>
6869
</dependency>
@@ -71,11 +72,6 @@
7172
<artifactId>atlassian-plugins-core</artifactId>
7273
<version>5.3.12</version>
7374
</dependency>
74-
<dependency>
75-
<groupId>org.json</groupId>
76-
<artifactId>json</artifactId>
77-
<version>20240303</version>
78-
</dependency>
7975
</dependencies>
8076
</dependencyManagement>
8177

@@ -234,6 +230,10 @@
234230
<groupId>io.jenkins.plugins</groupId>
235231
<artifactId>joda-time-api</artifactId>
236232
</dependency>
233+
<dependency>
234+
<groupId>io.jenkins.plugins</groupId>
235+
<artifactId>json-api</artifactId>
236+
</dependency>
237237
<dependency>
238238
<groupId>org.apache.maven</groupId>
239239
<artifactId>maven-artifact</artifactId>

src/main/java/hudson/plugins/jira/CredentialsHelper.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl;
1313
import edu.umd.cs.findbugs.annotations.CheckForNull;
1414
import edu.umd.cs.findbugs.annotations.NonNull;
15+
import hudson.model.Descriptor.FormException;
1516
import hudson.model.Item;
1617
import hudson.model.Queue;
1718
import hudson.model.queue.Tasks;
@@ -53,7 +54,7 @@ protected static StandardUsernamePasswordCredentials lookupSystemCredentials(
5354
}
5455

5556
protected static StandardUsernamePasswordCredentials migrateCredentials(
56-
@NonNull String username, String password, @CheckForNull URL url) {
57+
@NonNull String username, String password, @CheckForNull URL url) throws FormException {
5758
List<StandardUsernamePasswordCredentials> credentials = CredentialsMatchers.filter(
5859
CredentialsProvider.lookupCredentials(
5960
StandardUsernamePasswordCredentials.class,

src/main/java/hudson/plugins/jira/JiraSite.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import hudson.Util;
3535
import hudson.model.AbstractDescribableImpl;
3636
import hudson.model.Descriptor;
37+
import hudson.model.Descriptor.FormException;
3738
import hudson.model.Item;
3839
import hudson.model.ItemGroup;
3940
import hudson.model.Job;
@@ -306,7 +307,8 @@ public JiraSite(
306307
boolean updateJiraIssueForAllStatus,
307308
@CheckForNull String groupVisibility,
308309
@CheckForNull String roleVisibility,
309-
boolean useHTTPAuth) {
310+
boolean useHTTPAuth)
311+
throws FormException {
310312
this(
311313
url,
312314
alternativeUrl,
@@ -332,7 +334,8 @@ public JiraSite(
332334
boolean updateJiraIssueForAllStatus,
333335
String groupVisibility,
334336
String roleVisibility,
335-
boolean useHTTPAuth) {
337+
boolean useHTTPAuth)
338+
throws FormException {
336339
this(
337340
url,
338341
alternativeUrl,
@@ -646,8 +649,9 @@ public void setUpdateJiraIssueForAllStatus(boolean updateJiraIssueForAllStatus)
646649
}
647650

648651
@SuppressWarnings("unused")
649-
protected Object readResolve() {
652+
protected Object readResolve() throws FormException {
650653
JiraSite jiraSite;
654+
651655
if (credentialsId == null && userName != null && password != null) { // Migrate credentials
652656
jiraSite = new JiraSite(
653657
url,

src/test/java/com/atlassian/httpclient/apache/httpcomponents/ApacheAsyncHttpClientTest.java

+23-29
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,24 @@
1010
import hudson.ProxyConfiguration;
1111
import java.io.File;
1212
import java.io.IOException;
13+
import java.nio.charset.StandardCharsets;
1314
import java.nio.file.Path;
1415
import java.util.Base64;
1516
import java.util.Date;
1617
import java.util.Optional;
1718
import java.util.concurrent.TimeUnit;
18-
import javax.servlet.ServletException;
19-
import javax.servlet.http.HttpServletRequest;
20-
import javax.servlet.http.HttpServletResponse;
2119
import jenkins.model.Jenkins;
2220
import org.apache.commons.io.IOUtils;
2321
import org.apache.commons.lang3.StringUtils;
2422
import org.eclipse.jetty.http.HttpHeader;
2523
import org.eclipse.jetty.http.HttpStatus;
24+
import org.eclipse.jetty.io.Content;
2625
import org.eclipse.jetty.server.ConnectionFactory;
2726
import org.eclipse.jetty.server.Handler;
2827
import org.eclipse.jetty.server.HttpConnectionFactory;
2928
import org.eclipse.jetty.server.Server;
3029
import org.eclipse.jetty.server.ServerConnector;
31-
import org.eclipse.jetty.server.handler.AbstractHandler;
30+
import org.eclipse.jetty.util.Callback;
3231
import org.junit.After;
3332
import org.junit.Assert;
3433
import org.junit.Rule;
@@ -151,7 +150,7 @@ public void simple_post_with_proxy() throws Exception {
151150
Assert.assertEquals("FOO", testHandler.postReceived);
152151
}
153152

154-
public class ProxyTestHandler extends AbstractHandler {
153+
public static class ProxyTestHandler extends Handler.Abstract {
155154

156155
String postReceived;
157156

@@ -164,55 +163,50 @@ public class ProxyTestHandler extends AbstractHandler {
164163
final String realm = "test_realm";
165164

166165
@Override
167-
public void handle(
168-
String target,
169-
org.eclipse.jetty.server.Request jettyRequest,
170-
HttpServletRequest request,
171-
HttpServletResponse response)
172-
throws IOException, ServletException {
166+
public boolean handle(
167+
org.eclipse.jetty.server.Request request, org.eclipse.jetty.server.Response response, Callback callback)
168+
throws IOException {
173169

174170
final String credentials = Base64.getEncoder().encodeToString((user + ":" + password).getBytes("UTF-8"));
175171

176-
jettyRequest.setHandled(true);
177-
178-
String authorization = request.getHeader(HttpHeader.PROXY_AUTHORIZATION.asString());
172+
String authorization = request.getHeaders().get(HttpHeader.PROXY_AUTHORIZATION.asString());
179173
if (authorization == null) {
180174
response.setStatus(HttpStatus.PROXY_AUTHENTICATION_REQUIRED_407);
181-
response.setHeader(HttpHeader.PROXY_AUTHENTICATE.asString(), "Basic realm=\"" + realm + "\"");
182-
return;
175+
response.getHeaders().add(HttpHeader.PROXY_AUTHENTICATE.asString(), "Basic realm=\"" + realm + "\"");
176+
callback.succeeded();
177+
return true;
183178
} else {
184179
String prefix = "Basic ";
185180
if (authorization.startsWith(prefix)) {
186181
String attempt = authorization.substring(prefix.length());
187182
if (!credentials.equals(attempt)) {
188-
return;
183+
callback.succeeded();
184+
return true;
189185
}
190186
}
191187
}
192188

193189
if (StringUtils.equalsIgnoreCase("post", request.getMethod())) {
194-
postReceived = IOUtils.toString(request.getReader());
190+
postReceived = Content.Source.asString(request, StandardCharsets.UTF_8);
195191
}
196-
response.getWriter().write(CONTENT_RESPONSE);
192+
Content.Sink.write(response, true, CONTENT_RESPONSE, callback);
193+
return true;
197194
}
198195
}
199196

200-
public class TestHandler extends AbstractHandler {
197+
public static class TestHandler extends Handler.Abstract {
201198

202199
String postReceived;
203200

204201
@Override
205-
public void handle(
206-
String target,
207-
org.eclipse.jetty.server.Request jettyRequest,
208-
HttpServletRequest request,
209-
HttpServletResponse response)
210-
throws IOException, ServletException {
211-
jettyRequest.setHandled(true);
202+
public boolean handle(
203+
org.eclipse.jetty.server.Request request, org.eclipse.jetty.server.Response response, Callback callback)
204+
throws IOException {
212205
if (StringUtils.equalsIgnoreCase("post", request.getMethod())) {
213-
postReceived = IOUtils.toString(request.getReader());
206+
postReceived = Content.Source.asString(request, StandardCharsets.UTF_8);
214207
}
215-
response.getWriter().write(CONTENT_RESPONSE);
208+
Content.Sink.write(response, true, CONTENT_RESPONSE, callback);
209+
return true;
216210
}
217211
}
218212

src/test/java/hudson/plugins/jira/CredentialsHelperTest.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import com.cloudbees.plugins.credentials.domains.DomainSpecification;
1414
import com.cloudbees.plugins.credentials.domains.HostnameSpecification;
1515
import com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl;
16+
import hudson.model.Descriptor.FormException;
1617
import java.io.IOException;
1718
import java.net.MalformedURLException;
1819
import java.net.URL;
@@ -29,7 +30,7 @@ public class CredentialsHelperTest {
2930
public JenkinsRule r = new JenkinsRule();
3031

3132
@Test
32-
public void lookupSystemCredentials() throws IOException {
33+
public void lookupSystemCredentials() throws IOException, FormException {
3334
assertNull(CredentialsHelper.lookupSystemCredentials("nonexistent-credentials-id", null));
3435

3536
StandardUsernamePasswordCredentials c =
@@ -41,7 +42,7 @@ public void lookupSystemCredentials() throws IOException {
4142
}
4243

4344
@Test
44-
public void lookupSystemCredentialsWithDomainRestriction() throws IOException {
45+
public void lookupSystemCredentialsWithDomainRestriction() throws IOException, FormException {
4546
Domain domain = new Domain(
4647
"example",
4748
"test domain",
@@ -56,7 +57,7 @@ public void lookupSystemCredentialsWithDomainRestriction() throws IOException {
5657
}
5758

5859
@Test
59-
public void migrateCredentials() throws MalformedURLException {
60+
public void migrateCredentials() throws MalformedURLException, FormException {
6061
assertThat(
6162
CredentialsProvider.lookupStores(r.jenkins).iterator().next().getCredentials(Domain.global()), empty());
6263

@@ -70,7 +71,7 @@ public void migrateCredentials() throws MalformedURLException {
7071
}
7172

7273
@Test
73-
public void migrateCredentialsWithExsitingCredentials() throws IOException {
74+
public void migrateCredentialsWithExsitingCredentials() throws IOException, FormException {
7475
Domain domain = new Domain(
7576
"example",
7677
"test domain",

src/test/java/hudson/plugins/jira/DescriptorImplTest.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl;
2222
import hudson.model.AbstractBuild;
2323
import hudson.model.AbstractProject;
24+
import hudson.model.Descriptor.FormException;
2425
import hudson.model.FreeStyleBuild;
2526
import hudson.model.FreeStyleProject;
2627
import hudson.model.Item;
@@ -60,7 +61,7 @@ public class DescriptorImplTest {
6061
JiraSite.Builder builder = spy(new JiraSite.Builder());
6162

6263
@Test
63-
public void doFillCredentialsIdItems() throws IOException {
64+
public void doFillCredentialsIdItems() throws IOException, FormException {
6465

6566
MockFolder dummy = r.createFolder("dummy");
6667
r.jenkins.setSecurityRealm(r.createDummySecurityRealm());

src/test/java/hudson/plugins/jira/JiraSiteSecurity1029Test.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@
1313
import com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl;
1414
import hudson.model.Item;
1515
import hudson.model.User;
16+
import jakarta.servlet.ServletException;
17+
import jakarta.servlet.http.HttpServletRequest;
18+
import jakarta.servlet.http.HttpServletResponse;
1619
import java.io.IOException;
1720
import java.net.URI;
1821
import java.net.URL;
1922
import java.nio.charset.StandardCharsets;
2023
import java.util.Arrays;
2124
import java.util.Base64;
2225
import java.util.HashMap;
23-
import javax.servlet.ServletException;
24-
import javax.servlet.http.HttpServletRequest;
25-
import javax.servlet.http.HttpServletResponse;
2626
import jenkins.model.Jenkins;
2727
import jenkins.security.ApiTokenProperty;
2828
import net.sf.json.JSONObject;
29+
import org.eclipse.jetty.ee9.servlet.DefaultServlet;
30+
import org.eclipse.jetty.ee9.servlet.ServletContextHandler;
31+
import org.eclipse.jetty.ee9.servlet.ServletHolder;
2932
import org.eclipse.jetty.server.Server;
3033
import org.eclipse.jetty.server.ServerConnector;
31-
import org.eclipse.jetty.servlet.DefaultServlet;
32-
import org.eclipse.jetty.servlet.ServletContextHandler;
33-
import org.eclipse.jetty.servlet.ServletHolder;
3434
import org.htmlunit.HttpMethod;
3535
import org.htmlunit.Page;
3636
import org.htmlunit.WebRequest;

src/test/java/hudson/plugins/jira/JiraSiteTest.java

+9-7
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import com.cloudbees.plugins.credentials.domains.DomainSpecification;
2525
import com.cloudbees.plugins.credentials.domains.HostnameSpecification;
2626
import com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl;
27+
import hudson.model.Descriptor.FormException;
2728
import hudson.model.FreeStyleProject;
2829
import hudson.model.Job;
2930
import hudson.plugins.jira.model.JiraIssue;
@@ -62,7 +63,7 @@ public void init() throws MalformedURLException {
6263
}
6364

6465
@Test
65-
public void createSessionWithProvidedCredentials() {
66+
public void createSessionWithProvidedCredentials() throws FormException {
6667
JiraSite site = new JiraSite(
6768
validPrimaryUrl,
6869
null,
@@ -82,7 +83,7 @@ public void createSessionWithProvidedCredentials() {
8283

8384
@Test
8485
@Issue("JENKINS-64083")
85-
public void createSessionWithGlobalCredentials() {
86+
public void createSessionWithGlobalCredentials() throws FormException {
8687
JiraSite site = new JiraSite(
8788
validPrimaryUrl,
8889
null,
@@ -101,7 +102,7 @@ public void createSessionWithGlobalCredentials() {
101102
}
102103

103104
@Test
104-
public void createSessionReturnsNullIfCredentialsIsNull() {
105+
public void createSessionReturnsNullIfCredentialsIsNull() throws FormException {
105106
JiraSite site = new JiraSite(
106107
validPrimaryUrl,
107108
null,
@@ -120,7 +121,7 @@ public void createSessionReturnsNullIfCredentialsIsNull() {
120121
}
121122

122123
@Test
123-
public void deserializeMigrateCredentials() throws MalformedURLException {
124+
public void deserializeMigrateCredentials() throws MalformedURLException, FormException {
124125
JiraSiteOld old = new JiraSiteOld(
125126
validPrimaryUrl, null, ANY_USER, ANY_PASSWORD, false, false, null, false, null, null, true);
126127

@@ -153,7 +154,7 @@ public void deserializeMigrateCredentials() throws MalformedURLException {
153154
}
154155

155156
@Test
156-
public void deserializeNormal() throws IOException {
157+
public void deserializeNormal() throws IOException, FormException {
157158
Domain domain = new Domain(
158159
"example",
159160
"test domain",
@@ -207,7 +208,8 @@ private static class JiraSiteOld extends JiraSite {
207208
boolean updateJiraIssueForAllStatus,
208209
String groupVisibility,
209210
String roleVisibility,
210-
boolean useHTTPAuth) {
211+
boolean useHTTPAuth)
212+
throws FormException {
211213
super(
212214
url,
213215
alternativeUrl,
@@ -226,7 +228,7 @@ private static class JiraSiteOld extends JiraSite {
226228

227229
@Test
228230
@WithoutJenkins
229-
public void alternativeURLNotNull() {
231+
public void alternativeURLNotNull() throws FormException {
230232
JiraSite site = new JiraSite(
231233
validPrimaryUrl,
232234
exampleOrg,

0 commit comments

Comments
 (0)