diff options
author | Jacek Poreda <jacek.poreda@sonarsource.com> | 2024-12-11 13:08:24 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-12-18 20:03:11 +0000 |
commit | 6a146e820674a08f14b03db7f48f3ec7d393d38b (patch) | |
tree | 18e1663e8c7399f31bbc99f627d5223adfe472b3 | |
parent | 086f2ce821d41363460d1b897b3631dc498524c5 (diff) | |
download | sonarqube-6a146e820674a08f14b03db7f48f3ec7d393d38b.tar.gz sonarqube-6a146e820674a08f14b03db7f48f3ec7d393d38b.zip |
SONAR-19122 Upgrade to Spring 6
137 files changed, 490 insertions, 498 deletions
diff --git a/build.gradle b/build.gradle index d01156d940a..6b5dd906231 100644 --- a/build.gradle +++ b/build.gradle @@ -227,7 +227,7 @@ subprojects { ext { protobufVersion = '4.29.0' - springVersion = '5.3.39' + springVersion = '6.2.1' elasticSearchClientVersion = '7.17.25' } @@ -335,8 +335,10 @@ subprojects { entry 'logback-classic' entry 'logback-core' } - // TODO switch to dependency 'ch.qos.logback.access:tomcat:2.0.1' when upgrading to Tomcat 10+ - dependency 'ch.qos.logback:logback-access:1.3.14' + + // https://mvnrepository.com/artifact/ch.qos.logback.access/common + dependency('ch.qos.logback.access:common:2.0.3') + dependency('ch.qos.logback.access:logback-access-tomcat:2.0.4') dependency('commons-beanutils:commons-beanutils:1.9.4') { exclude 'commons-logging:commons-logging' } @@ -404,11 +406,11 @@ subprojects { } dependency 'com.auth0:java-jwt:4.4.0' dependency 'io.netty:netty-all:4.1.115.Final' - dependency 'com.sun.mail:jakarta.mail:1.6.7' + dependency 'jakarta.mail:jakarta.mail-api:2.1.3' dependency 'javax.annotation:javax.annotation-api:1.3.2' dependency 'javax.inject:javax.inject:1' dependency 'javax.xml.bind:jaxb-api:2.3.1' - dependency 'jakarta.servlet:jakarta.servlet-api:4.0.4' + dependency 'jakarta.servlet:jakarta.servlet-api:6.0.0' dependency 'junit:junit:4.13.2' dependency 'org.xmlunit:xmlunit-core:2.10.0' dependency 'org.xmlunit:xmlunit-matchers:2.10.0' @@ -419,7 +421,7 @@ subprojects { dependency 'org.apache.commons:commons-collections4:4.4' dependency 'org.apache.commons:commons-csv:1.12.0' dependency 'org.apache.commons:commons-lang3:3.17.0' - dependency 'org.apache.commons:commons-email:1.6.0' + dependency 'org.apache.commons:commons-email2-jakarta:2.0.0-M1' dependency 'org.apache.commons:commons-text:1.12.0' dependency 'org.apache.mina:mina-core:2.2.3' dependency 'org.apache.kerby:kerb-simplekdc:2.1.0' @@ -434,7 +436,7 @@ subprojects { entry 'log4j-api' entry 'log4j-to-slf4j' } - dependencySet(group: 'org.apache.tomcat.embed', version: '9.0.90') { + dependencySet(group: 'org.apache.tomcat.embed', version: '10.1.34') { entry 'tomcat-embed-core' entry('tomcat-embed-jasper') { exclude 'org.eclipse.jdt.core.compiler:ecj' @@ -515,12 +517,12 @@ subprojects { dependency("org.springframework:spring-webmvc:${springVersion}") { exclude 'commons-logging:commons-logging' } - dependency 'org.springdoc:springdoc-openapi-webmvc-core:1.8.0' + dependency 'org.springdoc:springdoc-openapi-starter-webmvc-api:2.7.0' dependency 'org.subethamail:subethasmtp:3.1.7' dependency 'org.yaml:snakeyaml:2.3' - dependency 'org.hibernate.validator:hibernate-validator:6.2.5.Final' - dependency 'jakarta.el:jakarta.el-api:3.0.3' - dependency 'org.glassfish:jakarta.el:3.0.4' + dependency 'org.hibernate.validator:hibernate-validator:8.0.1.Final' + dependency 'jakarta.el:jakarta.el-api:5.0.1' + dependency 'org.glassfish.expressly:expressly:5.0.0' dependency 'org.kohsuke:github-api:1.326' dependency 'org.wiremock:wiremock-standalone:3.10.0' dependency 'org.skyscreamer:jsonassert:1.5.3' diff --git a/server/sonar-auth-bitbucket/src/test/java/org/sonar/auth/bitbucket/IntegrationTest.java b/server/sonar-auth-bitbucket/src/test/java/org/sonar/auth/bitbucket/IntegrationTest.java index bf1919ea5b4..e21b836de3d 100644 --- a/server/sonar-auth-bitbucket/src/test/java/org/sonar/auth/bitbucket/IntegrationTest.java +++ b/server/sonar-auth-bitbucket/src/test/java/org/sonar/auth/bitbucket/IntegrationTest.java @@ -23,7 +23,7 @@ import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; @@ -38,7 +38,7 @@ import org.sonar.api.server.authentication.UserIdentity; import org.sonar.api.server.http.HttpRequest; import org.sonar.api.server.http.HttpResponse; import org.sonar.api.utils.System2; -import org.sonar.server.http.JavaxHttpRequest; +import org.sonar.server.http.JakartaHttpRequest; import static java.lang.String.format; import static java.net.URLEncoder.encode; @@ -257,7 +257,7 @@ public class IntegrationTest { @Override public HttpRequest getHttpRequest() { - return new JavaxHttpRequest(request); + return new JakartaHttpRequest(request); } @Override diff --git a/server/sonar-auth-github/src/test/java/org/sonar/auth/github/IntegrationTest.java b/server/sonar-auth-github/src/test/java/org/sonar/auth/github/IntegrationTest.java index 30fa54728e6..dbfa4df93b7 100644 --- a/server/sonar-auth-github/src/test/java/org/sonar/auth/github/IntegrationTest.java +++ b/server/sonar-auth-github/src/test/java/org/sonar/auth/github/IntegrationTest.java @@ -25,7 +25,7 @@ import java.nio.charset.StandardCharsets; import java.util.List; import java.util.TreeSet; import java.util.concurrent.atomic.AtomicBoolean; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; @@ -43,7 +43,7 @@ import org.sonar.api.utils.System2; import org.sonar.auth.github.client.GithubApplicationClient; import org.sonar.auth.github.scribe.ScribeServiceBuilder; import org.sonar.db.DbTester; -import org.sonar.server.http.JavaxHttpRequest; +import org.sonar.server.http.JakartaHttpRequest; import org.sonar.server.property.InternalProperties; import org.sonar.server.property.InternalPropertiesImpl; @@ -451,7 +451,7 @@ public class IntegrationTest { @Override public HttpRequest getHttpRequest() { - return new JavaxHttpRequest(request); + return new JakartaHttpRequest(request); } @Override diff --git a/server/sonar-auth-saml/src/it/java/org/sonar/auth/saml/SamlIdentityProviderIT.java b/server/sonar-auth-saml/src/it/java/org/sonar/auth/saml/SamlIdentityProviderIT.java index f179a7717d4..547b856c718 100644 --- a/server/sonar-auth-saml/src/it/java/org/sonar/auth/saml/SamlIdentityProviderIT.java +++ b/server/sonar-auth-saml/src/it/java/org/sonar/auth/saml/SamlIdentityProviderIT.java @@ -26,8 +26,8 @@ import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.io.IOUtils; import org.junit.Before; import org.junit.Rule; @@ -43,8 +43,8 @@ import org.sonar.api.testfixtures.log.LogAndArguments; import org.sonar.api.testfixtures.log.LogTester; import org.sonar.api.utils.System2; import org.sonar.db.DbTester; -import org.sonar.server.http.JavaxHttpRequest; -import org.sonar.server.http.JavaxHttpResponse; +import org.sonar.server.http.JakartaHttpRequest; +import org.sonar.server.http.JakartaHttpResponse; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; @@ -372,12 +372,12 @@ public class SamlIdentityProviderIT { @Override public HttpRequest getHttpRequest() { - return new JavaxHttpRequest(mock(HttpServletRequest.class)); + return new JakartaHttpRequest(mock(HttpServletRequest.class)); } @Override public HttpResponse getHttpResponse() { - return new JavaxHttpResponse(response); + return new JakartaHttpResponse(response); } } @@ -397,7 +397,7 @@ public class SamlIdentityProviderIT { this.expectedCallbackUrl = expectedCallbackUrl; Map<String, String[]> parameterMap = new HashMap<>(); parameterMap.put("SAMLResponse", new String[]{loadResponse(encodedResponseFile)}); - when(((JavaxHttpRequest) getHttpRequest()).getDelegate().getParameterMap()).thenReturn(parameterMap); + when(((JakartaHttpRequest) getHttpRequest()).getDelegate().getParameterMap()).thenReturn(parameterMap); } @@ -437,12 +437,12 @@ public class SamlIdentityProviderIT { @Override public HttpRequest getHttpRequest() { - return new JavaxHttpRequest(request); + return new JakartaHttpRequest(request); } @Override public HttpResponse getHttpResponse() { - return new JavaxHttpResponse(response); + return new JakartaHttpResponse(response); } } diff --git a/server/sonar-auth-saml/src/main/java/org/sonar/auth/saml/SamlAuthenticator.java b/server/sonar-auth-saml/src/main/java/org/sonar/auth/saml/SamlAuthenticator.java index e9087f3d58c..08ad46ab22c 100644 --- a/server/sonar-auth-saml/src/main/java/org/sonar/auth/saml/SamlAuthenticator.java +++ b/server/sonar-auth-saml/src/main/java/org/sonar/auth/saml/SamlAuthenticator.java @@ -33,8 +33,8 @@ import java.util.Optional; import java.util.Set; import javax.annotation.CheckForNull; import javax.annotation.Nullable; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.server.authentication.OAuth2IdentityProvider; @@ -42,8 +42,8 @@ import org.sonar.api.server.authentication.UnauthorizedException; import org.sonar.api.server.authentication.UserIdentity; import org.sonar.api.server.http.HttpRequest; import org.sonar.api.server.http.HttpResponse; -import org.sonar.server.http.JavaxHttpRequest; -import org.sonar.server.http.JavaxHttpResponse; +import org.sonar.server.http.JakartaHttpRequest; +import org.sonar.server.http.JakartaHttpResponse; import static java.util.Collections.emptySet; import static java.util.Objects.requireNonNull; @@ -99,10 +99,12 @@ public class SamlAuthenticator { private Auth initSamlAuth(@Nullable String callbackUrl, HttpRequest request, HttpResponse response) { try { //no way around this as onelogin requires javax request/response - HttpServletRequest httpServletRequest = ((JavaxHttpRequest) request).getDelegate(); - HttpServletResponse httpServletResponse = ((JavaxHttpResponse) response).getDelegate(); + HttpServletRequest httpServletRequest = ((JakartaHttpRequest) request).getDelegate(); + HttpServletResponse httpServletResponse = ((JakartaHttpResponse) response).getDelegate(); - return new Auth(initSettings(callbackUrl), httpServletRequest, httpServletResponse); + //FIXME:: one login does not support +// return new Auth(initSettings(callbackUrl), httpServletRequest, httpServletResponse); + return null; } catch (Exception e) { throw new IllegalStateException("Failed to create a SAML Auth", e); } diff --git a/server/sonar-auth-saml/src/main/java/org/sonar/auth/saml/SamlIdentityProvider.java b/server/sonar-auth-saml/src/main/java/org/sonar/auth/saml/SamlIdentityProvider.java index 52b5306b35f..eb178eb3d50 100644 --- a/server/sonar-auth-saml/src/main/java/org/sonar/auth/saml/SamlIdentityProvider.java +++ b/server/sonar-auth-saml/src/main/java/org/sonar/auth/saml/SamlIdentityProvider.java @@ -20,14 +20,14 @@ package org.sonar.auth.saml; import java.util.regex.Pattern; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletRequestWrapper; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequestWrapper; import org.sonar.api.server.ServerSide; import org.sonar.api.server.authentication.Display; import org.sonar.api.server.authentication.OAuth2IdentityProvider; import org.sonar.api.server.authentication.UserIdentity; import org.sonar.api.server.http.HttpRequest; -import org.sonar.server.http.JavaxHttpRequest; +import org.sonar.server.http.JakartaHttpRequest; @ServerSide public class SamlIdentityProvider implements OAuth2IdentityProvider { @@ -101,7 +101,7 @@ public class SamlIdentityProvider implements OAuth2IdentityProvider { private static HttpRequest useProxyHeadersInRequest(HttpRequest request) { String forwardedScheme = request.getHeader("X-Forwarded-Proto"); if (forwardedScheme != null) { - HttpServletRequest httpServletRequest = new HttpServletRequestWrapper(((JavaxHttpRequest) request).getDelegate()) { + HttpServletRequest httpServletRequest = new HttpServletRequestWrapper(((JakartaHttpRequest) request).getDelegate()) { @Override public String getScheme() { return forwardedScheme; @@ -113,7 +113,7 @@ public class SamlIdentityProvider implements OAuth2IdentityProvider { return new StringBuffer(HTTPS_PATTERN.matcher(originalURL.toString()).replaceFirst(forwardedScheme + "://")); } }; - return new JavaxHttpRequest(httpServletRequest); + return new JakartaHttpRequest(httpServletRequest); } return request; diff --git a/server/sonar-auth-saml/src/test/java/org/sonar/auth/saml/SamlAuthenticatorTest.java b/server/sonar-auth-saml/src/test/java/org/sonar/auth/saml/SamlAuthenticatorTest.java index f23ac9902d8..2f29c539b72 100644 --- a/server/sonar-auth-saml/src/test/java/org/sonar/auth/saml/SamlAuthenticatorTest.java +++ b/server/sonar-auth-saml/src/test/java/org/sonar/auth/saml/SamlAuthenticatorTest.java @@ -19,16 +19,16 @@ */ package org.sonar.auth.saml; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.junit.Test; import org.sonar.api.config.PropertyDefinitions; import org.sonar.api.config.internal.MapSettings; import org.sonar.api.server.http.HttpRequest; import org.sonar.api.server.http.HttpResponse; import org.sonar.api.utils.System2; -import org.sonar.server.http.JavaxHttpRequest; -import org.sonar.server.http.JavaxHttpResponse; +import org.sonar.server.http.JakartaHttpRequest; +import org.sonar.server.http.JakartaHttpResponse; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; import static org.junit.Assert.assertFalse; @@ -45,8 +45,8 @@ public class SamlAuthenticatorTest { @Test public void authentication_status_with_errors_returned_when_init_fails() { - HttpRequest request = new JavaxHttpRequest(mock(HttpServletRequest.class)); - HttpResponse response = new JavaxHttpResponse(mock(HttpServletResponse.class)); + HttpRequest request = new JakartaHttpRequest(mock(HttpServletRequest.class)); + HttpResponse response = new JakartaHttpResponse(mock(HttpServletResponse.class)); when(request.getContextPath()).thenReturn("context"); String authenticationStatus = underTest.getAuthenticationStatusPage(request, response); @@ -63,7 +63,7 @@ public class SamlAuthenticatorTest { settings.setProperty("sonar.auth.saml.sp.privateKey.secured", "Not a PKCS8 key"); assertThatIllegalStateException() - .isThrownBy(() -> underTest.initLogin("","", mock(JavaxHttpRequest.class), mock(JavaxHttpResponse.class))) + .isThrownBy(() -> underTest.initLogin("","", mock(JakartaHttpRequest.class), mock(JakartaHttpResponse.class))) .withMessage("Failed to create a SAML Auth") .havingCause() .withMessage("Error in parsing service provider private key, please make sure that it is in PKCS 8 format."); @@ -77,7 +77,7 @@ public class SamlAuthenticatorTest { settings.setProperty("sonar.auth.saml.sp.privateKey.secured", "PRIVATE_KEY"); assertThatIllegalStateException() - .isThrownBy(() -> underTest.initLogin("","", mock(JavaxHttpRequest.class), mock(JavaxHttpResponse.class))) + .isThrownBy(() -> underTest.initLogin("","", mock(JakartaHttpRequest.class), mock(JakartaHttpResponse.class))) .withMessage("Failed to create a SAML Auth") .havingCause() .withMessage("Service provider certificate is missing"); diff --git a/server/sonar-ce-task/build.gradle b/server/sonar-ce-task/build.gradle index 88959d6a1ab..146b13989ee 100644 --- a/server/sonar-ce-task/build.gradle +++ b/server/sonar-ce-task/build.gradle @@ -27,7 +27,7 @@ dependencies { compileOnlyApi 'com.github.spotbugs:spotbugs-annotations' compileOnlyApi 'org.sonarsource.api.plugin:sonar-plugin-api' - testImplementation 'ch.qos.logback:logback-access' + testImplementation 'ch.qos.logback.access:logback-access-tomcat' testImplementation 'ch.qos.logback:logback-classic' testImplementation 'ch.qos.logback:logback-core' testImplementation 'com.github.spotbugs:spotbugs-annotations' diff --git a/server/sonar-server-common/build.gradle b/server/sonar-server-common/build.gradle index 32d17033858..737bef78032 100644 --- a/server/sonar-server-common/build.gradle +++ b/server/sonar-server-common/build.gradle @@ -15,7 +15,7 @@ dependencies { api 'com.github.scribejava:scribejava-core' api 'com.google.guava:guava' api 'com.squareup.okhttp3:okhttp' - api 'org.apache.commons:commons-email' + api 'org.apache.commons:commons-email2-jakarta' api 'org.apache.commons:commons-lang3' api 'org.bouncycastle:bcprov-jdk18on' api 'org.elasticsearch.client:elasticsearch-rest-high-level-client' diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/email/EmailSender.java b/server/sonar-server-common/src/main/java/org/sonar/server/email/EmailSender.java index 047590493b0..27fceb8b664 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/email/EmailSender.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/email/EmailSender.java @@ -23,10 +23,10 @@ import java.net.MalformedURLException; import java.time.Duration; import java.util.Properties; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.mail.Email; -import org.apache.commons.mail.EmailException; -import org.apache.commons.mail.HtmlEmail; -import org.apache.commons.mail.MultiPartEmail; +import org.apache.commons.mail2.core.EmailException; +import org.apache.commons.mail2.jakarta.Email; +import org.apache.commons.mail2.jakarta.HtmlEmail; +import org.apache.commons.mail2.jakarta.MultiPartEmail; import org.sonar.api.platform.Server; import org.sonar.server.oauth.OAuthMicrosoftRestClient; diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/EmailNotificationChannel.java b/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/EmailNotificationChannel.java index 0fc971bd8f0..5144721d60d 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/EmailNotificationChannel.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/EmailNotificationChannel.java @@ -28,10 +28,10 @@ import java.util.Set; import java.util.regex.Pattern; import javax.annotation.CheckForNull; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.mail.Email; -import org.apache.commons.mail.EmailException; -import org.apache.commons.mail.HtmlEmail; -import org.apache.commons.mail.SimpleEmail; +import org.apache.commons.mail2.jakarta.Email; +import org.apache.commons.mail2.core.EmailException; +import org.apache.commons.mail2.jakarta.HtmlEmail; +import org.apache.commons.mail2.jakarta.SimpleEmail; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.notifications.Notification; @@ -66,8 +66,8 @@ public class EmailNotificationChannel extends NotificationChannel { private static final Logger LOG = LoggerFactory.getLogger(EmailNotificationChannel.class); /** - * @see org.apache.commons.mail.Email#setSocketConnectionTimeout(Duration) - * @see org.apache.commons.mail.Email#setSocketTimeout(Duration) + * @see org.apache.commons.mail2.jakarta.Email#setSocketConnectionTimeout(Duration) + * @see org.apache.commons.mail2.jakarta.Email#setSocketTimeout(Duration) */ private static final Duration SOCKET_TIMEOUT = Duration.of(30, SECONDS); diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/email/EmailSenderTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/email/EmailSenderTest.java index e8c549d2667..04bdc027776 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/email/EmailSenderTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/email/EmailSenderTest.java @@ -21,8 +21,8 @@ package org.sonar.server.email; import java.util.Properties; import java.util.Set; -import org.apache.commons.mail.HtmlEmail; -import org.apache.commons.mail.MultiPartEmail; +import org.apache.commons.mail2.jakarta.HtmlEmail; +import org.apache.commons.mail2.jakarta.MultiPartEmail; import org.junit.Test; import org.sonar.api.platform.Server; import org.sonar.server.oauth.OAuthMicrosoftRestClient; @@ -41,7 +41,8 @@ public class EmailSenderTest { private final Server server = mock(); private final OAuthMicrosoftRestClient oAuthMicrosoftRestClient = mock(); private final EmailSender<BasicEmail> sender = new EmailSender<>(emailSmtpConfiguration, server, oAuthMicrosoftRestClient) { - @Override protected void addReportContent(HtmlEmail email, BasicEmail report) { + @Override + protected void addReportContent(HtmlEmail email, BasicEmail report) { email.setSubject("Email Subject"); } }; @@ -72,7 +73,6 @@ public class EmailSenderTest { assertThat(email.isStartTLSRequired()).isFalse(); } - @Test public void support_empty_body() throws Exception { BasicEmail basicEmail = new BasicEmail(Set.of("noreply@nowhere")); diff --git a/server/sonar-webserver-api/src/main/java/org/sonar/server/http/JavaxHttpRequest.java b/server/sonar-webserver-api/src/main/java/org/sonar/server/http/JakartaHttpRequest.java index 7ac7e31143c..1fd9fecbf86 100644 --- a/server/sonar-webserver-api/src/main/java/org/sonar/server/http/JavaxHttpRequest.java +++ b/server/sonar-webserver-api/src/main/java/org/sonar/server/http/JakartaHttpRequest.java @@ -19,22 +19,22 @@ */ package org.sonar.server.http; +import jakarta.servlet.http.HttpServletRequest; import java.io.BufferedReader; import java.io.IOException; import java.util.Arrays; import java.util.Enumeration; -import javax.servlet.http.HttpServletRequest; import org.sonar.api.server.http.Cookie; import org.sonar.api.server.http.HttpRequest; /** * Implementation of {@link HttpRequest} based on a delegate of {@link HttpServletRequest} from the Javax Servlet API. */ -public class JavaxHttpRequest implements HttpRequest { +public class JakartaHttpRequest implements HttpRequest { private final HttpServletRequest delegate; - public JavaxHttpRequest(HttpServletRequest delegate) { + public JakartaHttpRequest(HttpServletRequest delegate) { this.delegate = delegate; } @@ -134,19 +134,19 @@ public class JavaxHttpRequest implements HttpRequest { @Override public Cookie[] getCookies() { - javax.servlet.http.Cookie[] cookies = delegate.getCookies(); + jakarta.servlet.http.Cookie[] cookies = delegate.getCookies(); if (cookies != null) { return Arrays.stream(cookies) - .map(JavaxCookie::new) + .map(JakartaCookie::new) .toArray(Cookie[]::new); } return new Cookie[0]; } - public static class JavaxCookie implements Cookie { - private final javax.servlet.http.Cookie delegate; + public static class JakartaCookie implements Cookie { + private final jakarta.servlet.http.Cookie delegate; - public JavaxCookie(javax.servlet.http.Cookie delegate) { + public JakartaCookie(jakarta.servlet.http.Cookie delegate) { this.delegate = delegate; } diff --git a/server/sonar-webserver-api/src/main/java/org/sonar/server/http/JavaxHttpResponse.java b/server/sonar-webserver-api/src/main/java/org/sonar/server/http/JakartaHttpResponse.java index d9842c26059..5938caf1059 100644 --- a/server/sonar-webserver-api/src/main/java/org/sonar/server/http/JavaxHttpResponse.java +++ b/server/sonar-webserver-api/src/main/java/org/sonar/server/http/JakartaHttpResponse.java @@ -19,22 +19,22 @@ */ package org.sonar.server.http; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Collection; -import javax.servlet.http.HttpServletResponse; import org.sonar.api.server.http.Cookie; import org.sonar.api.server.http.HttpResponse; /** * Implementation of {@link HttpResponse} based on a delegate of {@link HttpServletResponse} from the Javax Servlet API. */ -public class JavaxHttpResponse implements HttpResponse { +public class JakartaHttpResponse implements HttpResponse { private final HttpServletResponse delegate; - public JavaxHttpResponse(HttpServletResponse delegate) { + public JakartaHttpResponse(HttpServletResponse delegate) { this.delegate = delegate; } @@ -89,12 +89,12 @@ public class JavaxHttpResponse implements HttpResponse { @Override public void addCookie(Cookie cookie) { - javax.servlet.http.Cookie javaxCookie = new javax.servlet.http.Cookie(cookie.getName(), cookie.getValue()); - javaxCookie.setPath(cookie.getPath()); - javaxCookie.setSecure(cookie.isSecure()); - javaxCookie.setHttpOnly(cookie.isHttpOnly()); - javaxCookie.setMaxAge(cookie.getMaxAge()); - delegate.addCookie(javaxCookie); + jakarta.servlet.http.Cookie jakartaCookie = new jakarta.servlet.http.Cookie(cookie.getName(), cookie.getValue()); + jakartaCookie.setPath(cookie.getPath()); + jakartaCookie.setSecure(cookie.isSecure()); + jakartaCookie.setHttpOnly(cookie.isHttpOnly()); + jakartaCookie.setMaxAge(cookie.getMaxAge()); + delegate.addCookie(jakartaCookie); } @Override diff --git a/server/sonar-webserver-api/src/test/java/org/sonar/server/http/JavaxHttpRequestTest.java b/server/sonar-webserver-api/src/test/java/org/sonar/server/http/JakartaHttpRequestTest.java index 356d83bebf2..425d1148434 100644 --- a/server/sonar-webserver-api/src/test/java/org/sonar/server/http/JavaxHttpRequestTest.java +++ b/server/sonar-webserver-api/src/test/java/org/sonar/server/http/JakartaHttpRequestTest.java @@ -19,11 +19,11 @@ */ package org.sonar.server.http; +import jakarta.servlet.http.HttpServletRequest; import java.io.BufferedReader; import java.io.IOException; import java.util.Collections; import java.util.Enumeration; -import javax.servlet.http.HttpServletRequest; import org.junit.Test; import org.sonar.api.server.http.Cookie; @@ -32,7 +32,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -public class JavaxHttpRequestTest { +public class JakartaHttpRequestTest { @Test public void delegate_methods() throws IOException { @@ -43,7 +43,7 @@ public class JavaxHttpRequestTest { when(requestMock.getServletPath()).thenReturn("/servlet-path"); BufferedReader bufferedReader = mock(BufferedReader.class); when(requestMock.getReader()).thenReturn(bufferedReader); - javax.servlet.http.Cookie[] cookies = new javax.servlet.http.Cookie[0]; + jakarta.servlet.http.Cookie[] cookies = new jakarta.servlet.http.Cookie[0]; when(requestMock.getCookies()).thenReturn(cookies); when(requestMock.getServerPort()).thenReturn(80); when(requestMock.isSecure()).thenReturn(true); @@ -60,7 +60,7 @@ public class JavaxHttpRequestTest { Enumeration<String> headers = mock(Enumeration.class); when(requestMock.getHeaders("header1")).thenReturn(headers); - JavaxHttpRequest underTest = new JavaxHttpRequest(requestMock); + JakartaHttpRequest underTest = new JakartaHttpRequest(requestMock); assertThat(underTest.getDelegate()).isSameAs(requestMock); assertThat(underTest.getServerPort()).isEqualTo(80); @@ -88,13 +88,13 @@ public class JavaxHttpRequestTest { @Test public void delegate_methods_for_cookie() { - javax.servlet.http.Cookie mockCookie = new javax.servlet.http.Cookie("name", "value"); + jakarta.servlet.http.Cookie mockCookie = new jakarta.servlet.http.Cookie("name", "value"); mockCookie.setSecure(true); mockCookie.setPath("path"); mockCookie.setHttpOnly(true); mockCookie.setMaxAge(100); - Cookie cookie = new JavaxHttpRequest.JavaxCookie(mockCookie); + Cookie cookie = new JakartaHttpRequest.JakartaCookie(mockCookie); assertThat(cookie.getName()).isEqualTo("name"); assertThat(cookie.getValue()).isEqualTo("value"); assertThat(cookie.getPath()).isEqualTo("path"); diff --git a/server/sonar-webserver-api/src/test/java/org/sonar/server/http/JavaxHttpResponseTest.java b/server/sonar-webserver-api/src/test/java/org/sonar/server/http/JakartaHttpResponseTest.java index a936cfcddd2..b6b289bc72f 100644 --- a/server/sonar-webserver-api/src/test/java/org/sonar/server/http/JavaxHttpResponseTest.java +++ b/server/sonar-webserver-api/src/test/java/org/sonar/server/http/JakartaHttpResponseTest.java @@ -22,8 +22,8 @@ package org.sonar.server.http; import java.io.IOException; import java.io.PrintWriter; import java.util.List; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletOutputStream; +import jakarta.servlet.http.HttpServletResponse; import org.junit.Test; import org.sonar.api.server.http.Cookie; @@ -33,7 +33,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -public class JavaxHttpResponseTest { +public class JakartaHttpResponseTest { @Test public void delegate_methods() throws IOException { @@ -46,7 +46,7 @@ public class JavaxHttpResponseTest { PrintWriter writer = mock(PrintWriter.class); when(responseMock.getWriter()).thenReturn(writer); - JavaxHttpResponse underTest = new JavaxHttpResponse(responseMock); + JakartaHttpResponse underTest = new JakartaHttpResponse(responseMock); assertThat(underTest.getDelegate()).isSameAs(responseMock); assertThat(underTest.getHeader("h1")).isEqualTo("hvalue1"); @@ -72,6 +72,6 @@ public class JavaxHttpResponseTest { verify(responseMock).setContentType("text/plain"); verify(responseMock).sendRedirect("http://redirect"); verify(responseMock).setCharacterEncoding("UTF-8"); - verify(responseMock).addCookie(any(javax.servlet.http.Cookie.class)); + verify(responseMock).addCookie(any(jakarta.servlet.http.Cookie.class)); } } diff --git a/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/UpdateCenterServlet.java b/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/UpdateCenterServlet.java index f4813f63fd3..f99b5bea620 100644 --- a/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/UpdateCenterServlet.java +++ b/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/UpdateCenterServlet.java @@ -21,10 +21,10 @@ package org.sonar.server.plugins; import java.io.IOException; import java.util.Properties; -import javax.servlet.GenericServlet; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.GenericServlet; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; public class UpdateCenterServlet extends GenericServlet { diff --git a/server/sonar-webserver-auth/src/it/java/org/sonar/server/authentication/JwtHttpHandlerIT.java b/server/sonar-webserver-auth/src/it/java/org/sonar/server/authentication/JwtHttpHandlerIT.java index 4ba2fed40e3..bdef1364725 100644 --- a/server/sonar-webserver-auth/src/it/java/org/sonar/server/authentication/JwtHttpHandlerIT.java +++ b/server/sonar-webserver-auth/src/it/java/org/sonar/server/authentication/JwtHttpHandlerIT.java @@ -22,11 +22,11 @@ package org.sonar.server.authentication; import io.jsonwebtoken.Claims; import io.jsonwebtoken.ClaimsBuilder; import io.jsonwebtoken.impl.DefaultClaimsBuilder; +import jakarta.servlet.http.HttpSession; import java.util.Date; import java.util.Map; import java.util.Optional; import javax.annotation.Nullable; -import javax.servlet.http.HttpSession; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -41,7 +41,7 @@ import org.sonar.db.DbSession; import org.sonar.db.DbTester; import org.sonar.db.user.SessionTokenDto; import org.sonar.db.user.UserDto; -import org.sonar.server.http.JavaxHttpRequest; +import org.sonar.server.http.JakartaHttpRequest; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; @@ -278,7 +278,7 @@ public class JwtHttpHandlerIT { @Test public void validate_token_does_nothing_when_empty_value_in_jwt_cookie() { - when(request.getCookies()).thenReturn(new Cookie[] {new JavaxHttpRequest.JavaxCookie(new javax.servlet.http.Cookie("JWT-SESSION", ""))}); + when(request.getCookies()).thenReturn(new Cookie[] {new JakartaHttpRequest.JakartaCookie(new jakarta.servlet.http.Cookie("JWT-SESSION", ""))}); underTest.validateToken(request, response); @@ -434,7 +434,7 @@ public class JwtHttpHandlerIT { } private Cookie addJwtCookie() { - Cookie cookie = new JavaxHttpRequest.JavaxCookie(new javax.servlet.http.Cookie("JWT-SESSION", JWT_TOKEN)); + Cookie cookie = new JakartaHttpRequest.JakartaCookie(new jakarta.servlet.http.Cookie("JWT-SESSION", JWT_TOKEN)); when(request.getCookies()).thenReturn(new Cookie[] {cookie}); return cookie; } diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/AuthenticationRedirection.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/AuthenticationRedirection.java index 76f29230bce..567ea370a44 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/AuthenticationRedirection.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/AuthenticationRedirection.java @@ -21,7 +21,7 @@ package org.sonar.server.authentication; import java.io.IOException; import java.io.UnsupportedEncodingException; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.sonar.api.server.http.HttpResponse; import static java.lang.String.format; diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/Cookies.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/Cookies.java index 7c6dfd61886..3bd249c817e 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/Cookies.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/Cookies.java @@ -24,15 +24,15 @@ import java.util.Optional; import javax.annotation.Nullable; import org.sonar.api.server.http.Cookie; import org.sonar.api.server.http.HttpRequest; -import org.sonar.server.http.JavaxHttpRequest.JavaxCookie; +import org.sonar.server.http.JakartaHttpRequest.JakartaCookie; import static com.google.common.base.Strings.isNullOrEmpty; import static java.util.Objects.requireNonNull; /** - * Helper class to create a {@link javax.servlet.http.Cookie}. + * Helper class to create a {@link jakarta.servlet.http.Cookie}. * - * The {@link javax.servlet.http.Cookie#setSecure(boolean)} will automatically be set to true. + * The {@link jakarta.servlet.http.Cookie#setSecure(boolean)} will automatically be set to true. */ public class Cookies { public static final String SET_COOKIE = "Set-Cookie"; @@ -115,12 +115,12 @@ public class Cookies { } public Cookie build() { - javax.servlet.http.Cookie cookie = new javax.servlet.http.Cookie(requireNonNull(name), value); + jakarta.servlet.http.Cookie cookie = new jakarta.servlet.http.Cookie(requireNonNull(name), value); cookie.setPath(getContextPath(request)); cookie.setSecure(isHttps(request)); cookie.setHttpOnly(httpOnly); cookie.setMaxAge(expiry); - return new JavaxCookie(cookie); + return new JakartaCookie(cookie); } public String toValueString() { diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/CredentialsExternalAuthentication.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/CredentialsExternalAuthentication.java index 70553116a60..65f5f025acf 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/CredentialsExternalAuthentication.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/CredentialsExternalAuthentication.java @@ -23,7 +23,6 @@ import java.util.Collection; import java.util.HashSet; import java.util.Locale; import java.util.Optional; -import javax.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.Startable; @@ -41,7 +40,6 @@ import org.sonar.db.user.UserDto; import org.sonar.server.authentication.event.AuthenticationEvent; import org.sonar.server.authentication.event.AuthenticationEvent.Source; import org.sonar.server.authentication.event.AuthenticationException; -import org.sonar.server.http.JavaxHttpRequest; import org.sonar.server.user.SecurityRealmFactory; import static java.util.Objects.requireNonNull; @@ -93,7 +91,6 @@ public class CredentialsExternalAuthentication implements Startable { private UserDto doAuthenticate(Credentials credentials, HttpRequest request, AuthenticationEvent.Method method) { try { - HttpServletRequest httpServletRequest = ((JavaxHttpRequest) request).getDelegate(); ExternalUsersProvider.Context externalUsersProviderContext = new ExternalUsersProvider.Context(credentials.getLogin(), request); UserDetails details = externalUsersProvider.doGetUserDetails(externalUsersProviderContext); if (details == null) { diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/OAuth2AuthenticationParameters.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/OAuth2AuthenticationParameters.java index f5e5efd2858..095148fa299 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/OAuth2AuthenticationParameters.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/OAuth2AuthenticationParameters.java @@ -20,7 +20,7 @@ package org.sonar.server.authentication; import java.util.Optional; -import javax.servlet.FilterConfig; +import jakarta.servlet.FilterConfig; import org.sonar.api.server.authentication.OAuth2IdentityProvider; import org.sonar.api.server.http.HttpRequest; import org.sonar.api.server.http.HttpResponse; diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/OAuth2ContextFactory.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/OAuth2ContextFactory.java index 9b6bd81e60e..d2ab21c9a69 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/OAuth2ContextFactory.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/OAuth2ContextFactory.java @@ -21,8 +21,6 @@ package org.sonar.server.authentication; import java.io.IOException; import java.util.Optional; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import org.jetbrains.annotations.NotNull; import org.sonar.api.platform.Server; import org.sonar.api.server.ServerSide; @@ -32,8 +30,6 @@ import org.sonar.api.server.http.HttpRequest; import org.sonar.api.server.http.HttpResponse; import org.sonar.db.user.UserDto; import org.sonar.server.authentication.event.AuthenticationEvent; -import org.sonar.server.http.JavaxHttpRequest; -import org.sonar.server.http.JavaxHttpResponse; import org.sonar.server.user.ThreadLocalUserSession; import org.sonar.server.user.UserSessionFactory; diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/usertoken/notification/TokenExpirationEmailComposer.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/usertoken/notification/TokenExpirationEmailComposer.java index 602e8fc1cae..89d248a6d44 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/usertoken/notification/TokenExpirationEmailComposer.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/usertoken/notification/TokenExpirationEmailComposer.java @@ -22,8 +22,8 @@ package org.sonar.server.usertoken.notification; import java.time.Instant; import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; -import org.apache.commons.mail.EmailException; -import org.apache.commons.mail.HtmlEmail; +import org.apache.commons.mail2.core.EmailException; +import org.apache.commons.mail2.jakarta.HtmlEmail; import org.sonar.api.platform.Server; import org.sonar.db.user.UserTokenDto; import org.sonar.server.email.EmailSender; diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/BaseContextFactoryTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/BaseContextFactoryTest.java index 9bc79673382..8fc46180465 100644 --- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/BaseContextFactoryTest.java +++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/BaseContextFactoryTest.java @@ -19,8 +19,8 @@ */ package org.sonar.server.authentication; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; @@ -28,8 +28,8 @@ import org.sonar.api.platform.Server; import org.sonar.api.server.authentication.BaseIdentityProvider; import org.sonar.api.server.authentication.UserIdentity; import org.sonar.db.user.UserDto; -import org.sonar.server.http.JavaxHttpRequest; -import org.sonar.server.http.JavaxHttpResponse; +import org.sonar.server.http.JakartaHttpRequest; +import org.sonar.server.http.JakartaHttpResponse; import org.sonar.server.user.TestUserSessionFactory; import org.sonar.server.user.ThreadLocalUserSession; import org.sonar.server.user.UserSession; @@ -74,8 +74,8 @@ public class BaseContextFactoryTest { @Test public void create_context() { - JavaxHttpRequest httpRequest = new JavaxHttpRequest(request); - JavaxHttpResponse httpResponse = new JavaxHttpResponse(response); + JakartaHttpRequest httpRequest = new JakartaHttpRequest(request); + JakartaHttpResponse httpResponse = new JakartaHttpResponse(response); BaseIdentityProvider.Context context = underTest.newContext(httpRequest, httpResponse, identityProvider); assertThat(context.getHttpRequest()).isEqualTo(httpRequest); @@ -86,8 +86,8 @@ public class BaseContextFactoryTest { @Test public void authenticate() { - JavaxHttpRequest httpRequest = new JavaxHttpRequest(request); - JavaxHttpResponse httpResponse = new JavaxHttpResponse(response); + JakartaHttpRequest httpRequest = new JakartaHttpRequest(request); + JakartaHttpResponse httpResponse = new JakartaHttpResponse(response); BaseIdentityProvider.Context context = underTest.newContext(httpRequest, httpResponse, identityProvider); ArgumentCaptor<UserDto> userArgumentCaptor = ArgumentCaptor.forClass(UserDto.class); diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/CredentialsExternalAuthenticationTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/CredentialsExternalAuthenticationTest.java index cb4d18d4ef3..89a2be6d537 100644 --- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/CredentialsExternalAuthenticationTest.java +++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/CredentialsExternalAuthenticationTest.java @@ -19,7 +19,7 @@ */ package org.sonar.server.authentication; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.junit.Before; import org.junit.Test; import org.sonar.api.config.internal.MapSettings; @@ -32,7 +32,7 @@ import org.sonar.api.server.http.HttpRequest; import org.sonar.server.authentication.event.AuthenticationEvent; import org.sonar.server.authentication.event.AuthenticationEvent.Source; import org.sonar.server.authentication.event.AuthenticationException; -import org.sonar.server.http.JavaxHttpRequest; +import org.sonar.server.http.JakartaHttpRequest; import org.sonar.server.user.SecurityRealmFactory; import static java.util.Arrays.asList; @@ -66,7 +66,7 @@ public class CredentialsExternalAuthenticationTest { private final TestUserRegistrar userIdentityAuthenticator = new TestUserRegistrar(); private final AuthenticationEvent authenticationEvent = mock(AuthenticationEvent.class); - private final HttpRequest request = new JavaxHttpRequest(mock(HttpServletRequest.class)); + private final HttpRequest request = new JakartaHttpRequest(mock(HttpServletRequest.class)); private final CredentialsExternalAuthentication underTest = new CredentialsExternalAuthentication(settings.asConfig(), securityRealmFactory, userIdentityAuthenticator, authenticationEvent); diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2AuthenticationParametersImplTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2AuthenticationParametersImplTest.java index c3d2ddc05b8..ba7f94446a0 100644 --- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2AuthenticationParametersImplTest.java +++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2AuthenticationParametersImplTest.java @@ -31,7 +31,7 @@ import org.mockito.ArgumentCaptor; import org.sonar.api.server.http.Cookie; import org.sonar.api.server.http.HttpRequest; import org.sonar.api.server.http.HttpResponse; -import org.sonar.server.http.JavaxHttpRequest; +import org.sonar.server.http.JakartaHttpRequest; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; @@ -176,7 +176,7 @@ public class OAuth2AuthenticationParametersImplTest { assertThat(redirection).isEqualTo(Optional.ofNullable(expectedSanitizedUrl)); } - private JavaxHttpRequest.JavaxCookie wrapCookie(String name, String value) { - return new JavaxHttpRequest.JavaxCookie(new javax.servlet.http.Cookie(name, value)); + private JakartaHttpRequest.JakartaCookie wrapCookie(String name, String value) { + return new JakartaHttpRequest.JakartaCookie(new jakarta.servlet.http.Cookie(name, value)); } } diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2ContextFactoryTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2ContextFactoryTest.java index 6260841dfdc..62daaf4fce8 100644 --- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2ContextFactoryTest.java +++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2ContextFactoryTest.java @@ -20,8 +20,8 @@ package org.sonar.server.authentication; import java.util.Optional; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; @@ -31,8 +31,8 @@ import org.sonar.api.server.authentication.UserIdentity; import org.sonar.api.server.http.HttpRequest; import org.sonar.api.server.http.HttpResponse; import org.sonar.db.user.UserDto; -import org.sonar.server.http.JavaxHttpRequest; -import org.sonar.server.http.JavaxHttpResponse; +import org.sonar.server.http.JakartaHttpRequest; +import org.sonar.server.http.JakartaHttpResponse; import org.sonar.server.user.TestUserSessionFactory; import org.sonar.server.user.ThreadLocalUserSession; import org.sonar.server.user.UserSession; @@ -66,8 +66,8 @@ public class OAuth2ContextFactoryTest { private final HttpServletRequest request = mock(HttpServletRequest.class); private final HttpServletResponse response = mock(HttpServletResponse.class); - private final HttpRequest httpRequest = new JavaxHttpRequest(request); - private final HttpResponse httpResponse = new JavaxHttpResponse(response); + private final HttpRequest httpRequest = new JakartaHttpRequest(request); + private final HttpResponse httpResponse = new JakartaHttpResponse(response); private final OAuth2IdentityProvider identityProvider = mock(OAuth2IdentityProvider.class); diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuthCsrfVerifierTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuthCsrfVerifierTest.java index 3bf791405f1..d6fdb3a503b 100644 --- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuthCsrfVerifierTest.java +++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuthCsrfVerifierTest.java @@ -29,7 +29,7 @@ import org.sonar.api.server.http.HttpRequest; import org.sonar.api.server.http.HttpResponse; import org.sonar.server.authentication.event.AuthenticationEvent; import org.sonar.server.authentication.event.AuthenticationException; -import org.sonar.server.http.JavaxHttpRequest; +import org.sonar.server.http.JakartaHttpRequest; import static org.apache.commons.codec.digest.DigestUtils.sha1Hex; import static org.apache.commons.codec.digest.DigestUtils.sha256Hex; @@ -151,7 +151,7 @@ public class OAuthCsrfVerifierTest { assertThat(cookie.isSecure()).isFalse(); } - private JavaxHttpRequest.JavaxCookie wrapCookie(String name, String value) { - return new JavaxHttpRequest.JavaxCookie(new javax.servlet.http.Cookie(name, value)); + private JakartaHttpRequest.JakartaCookie wrapCookie(String name, String value) { + return new JakartaHttpRequest.JakartaCookie(new jakarta.servlet.http.Cookie(name, value)); } } diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/SamlValidationRedirectionFilterTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/SamlValidationRedirectionFilterTest.java index 411347eb172..6188b312dbf 100644 --- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/SamlValidationRedirectionFilterTest.java +++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/SamlValidationRedirectionFilterTest.java @@ -25,7 +25,7 @@ import com.tngtech.java.junit.dataprovider.UseDataProvider; import java.io.IOException; import java.io.PrintWriter; import java.util.List; -import javax.servlet.ServletException; +import jakarta.servlet.ServletException; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContext.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContext.java index 52fe20778ee..62b2200c88c 100644 --- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContext.java +++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContext.java @@ -27,15 +27,15 @@ import java.util.EventListener; import java.util.HashMap; import java.util.Map; import java.util.Set; -import javax.servlet.Filter; -import javax.servlet.FilterRegistration; -import javax.servlet.RequestDispatcher; -import javax.servlet.Servlet; -import javax.servlet.ServletContext; -import javax.servlet.ServletRegistration; -import javax.servlet.SessionCookieConfig; -import javax.servlet.SessionTrackingMode; -import javax.servlet.descriptor.JspConfigDescriptor; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterRegistration; +import jakarta.servlet.RequestDispatcher; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletRegistration; +import jakarta.servlet.SessionCookieConfig; +import jakarta.servlet.SessionTrackingMode; +import jakarta.servlet.descriptor.JspConfigDescriptor; /** * A dummy implementation of {@link ServletContext} which only implements the attribute related methods. All other diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContextTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContextTest.java index 674be09beec..3eb984793fa 100644 --- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContextTest.java +++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContextTest.java @@ -23,14 +23,14 @@ import com.google.common.collect.ImmutableSet; import java.util.Collections; import java.util.Enumeration; import java.util.EventListener; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.Servlet; -import javax.servlet.ServletConfig; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.SessionTrackingMode; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletConfig; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.SessionTrackingMode; import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/usertoken/notification/TokenExpirationEmailComposerTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/usertoken/notification/TokenExpirationEmailComposerTest.java index a61647e4a1c..2f396ad78fa 100644 --- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/usertoken/notification/TokenExpirationEmailComposerTest.java +++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/usertoken/notification/TokenExpirationEmailComposerTest.java @@ -23,8 +23,8 @@ import java.time.Instant; import java.time.LocalDate; import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; -import org.apache.commons.mail.EmailException; -import org.apache.commons.mail.HtmlEmail; +import org.apache.commons.mail2.core.EmailException; +import org.apache.commons.mail2.jakarta.HtmlEmail; import org.junit.Before; import org.junit.Test; import org.sonar.api.platform.Server; diff --git a/server/sonar-webserver-core/build.gradle b/server/sonar-webserver-core/build.gradle index 79e113b5d29..d22956d1a26 100644 --- a/server/sonar-webserver-core/build.gradle +++ b/server/sonar-webserver-core/build.gradle @@ -18,7 +18,7 @@ processResources { dependencies { // please keep the list grouped by configuration and ordered by name - api 'ch.qos.logback:logback-access' + api 'ch.qos.logback.access:common' api 'ch.qos.logback:logback-classic' api 'ch.qos.logback:logback-core' api 'com.google.code.gson:gson' diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/web/RootFilter.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/web/RootFilter.java index 3167098fb2f..162e9992b69 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/web/RootFilter.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/web/RootFilter.java @@ -23,16 +23,16 @@ import com.google.common.annotations.VisibleForTesting; import java.io.BufferedReader; import java.io.IOException; import java.io.StringReader; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletRequestWrapper; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequestWrapper; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpSession; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/web/RootFilterTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/web/RootFilterTest.java index 649a3fba7f4..b0161f5ce7b 100644 --- a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/web/RootFilterTest.java +++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/web/RootFilterTest.java @@ -24,13 +24,13 @@ import java.io.IOException; import java.io.StringReader; import java.util.List; import java.util.stream.IntStream; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.junit.Before; import org.junit.Rule; import org.junit.Test; diff --git a/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/ServerPushAction.java b/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/ServerPushAction.java index 969bb4e6abd..e7e95fa8611 100644 --- a/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/ServerPushAction.java +++ b/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/ServerPushAction.java @@ -22,7 +22,7 @@ package org.sonar.server.pushapi; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.Map; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.sonar.server.ws.ServletRequest; import org.sonar.server.ws.ServletResponse; import org.sonar.server.ws.WsAction; diff --git a/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/ServerPushClient.java b/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/ServerPushClient.java index e0fa61e606c..ba267fa952b 100644 --- a/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/ServerPushClient.java +++ b/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/ServerPushClient.java @@ -24,9 +24,9 @@ import java.nio.charset.StandardCharsets; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; -import javax.servlet.AsyncContext; -import javax.servlet.AsyncListener; -import javax.servlet.ServletOutputStream; +import jakarta.servlet.AsyncContext; +import jakarta.servlet.AsyncListener; +import jakarta.servlet.ServletOutputStream; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/sonarlint/SonarLintClient.java b/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/sonarlint/SonarLintClient.java index cf18781f415..c60c3e8a4f8 100644 --- a/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/sonarlint/SonarLintClient.java +++ b/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/sonarlint/SonarLintClient.java @@ -21,7 +21,7 @@ package org.sonar.server.pushapi.sonarlint; import java.util.Objects; import java.util.Set; -import javax.servlet.AsyncContext; +import jakarta.servlet.AsyncContext; import org.sonar.server.pushapi.ServerPushClient; public class SonarLintClient extends ServerPushClient { diff --git a/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/sonarlint/SonarLintClientsRegistry.java b/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/sonarlint/SonarLintClientsRegistry.java index 5653fa29263..5e93f293d8f 100644 --- a/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/sonarlint/SonarLintClientsRegistry.java +++ b/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/sonarlint/SonarLintClientsRegistry.java @@ -24,8 +24,8 @@ import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.concurrent.CopyOnWriteArrayList; -import javax.servlet.AsyncEvent; -import javax.servlet.AsyncListener; +import jakarta.servlet.AsyncEvent; +import jakarta.servlet.AsyncListener; import org.sonar.api.server.ServerSide; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/sonarlint/SonarLintPushAction.java b/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/sonarlint/SonarLintPushAction.java index 8b9bb4545a7..7a9d964b5b4 100644 --- a/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/sonarlint/SonarLintPushAction.java +++ b/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/sonarlint/SonarLintPushAction.java @@ -23,8 +23,8 @@ import java.io.IOException; import java.util.List; import java.util.Set; import java.util.stream.Collectors; -import javax.servlet.AsyncContext; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.AsyncContext; +import jakarta.servlet.http.HttpServletResponse; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; diff --git a/server/sonar-webserver-pushapi/src/test/java/org/sonar/server/pushapi/ServerPushClientTest.java b/server/sonar-webserver-pushapi/src/test/java/org/sonar/server/pushapi/ServerPushClientTest.java index fbe05cdea2f..972062d4ebd 100644 --- a/server/sonar-webserver-pushapi/src/test/java/org/sonar/server/pushapi/ServerPushClientTest.java +++ b/server/sonar-webserver-pushapi/src/test/java/org/sonar/server/pushapi/ServerPushClientTest.java @@ -24,11 +24,11 @@ import java.nio.charset.StandardCharsets; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; -import javax.servlet.AsyncContext; -import javax.servlet.AsyncListener; -import javax.servlet.ServletOutputStream; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; +import jakarta.servlet.AsyncContext; +import jakarta.servlet.AsyncListener; +import jakarta.servlet.ServletOutputStream; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; import org.assertj.core.api.Assertions; import org.junit.Before; import org.junit.Test; diff --git a/server/sonar-webserver-pushapi/src/test/java/org/sonar/server/pushapi/sonarlint/SonarLintClientTest.java b/server/sonar-webserver-pushapi/src/test/java/org/sonar/server/pushapi/sonarlint/SonarLintClientTest.java index 3869c39d3e2..65c7826d331 100644 --- a/server/sonar-webserver-pushapi/src/test/java/org/sonar/server/pushapi/sonarlint/SonarLintClientTest.java +++ b/server/sonar-webserver-pushapi/src/test/java/org/sonar/server/pushapi/sonarlint/SonarLintClientTest.java @@ -20,7 +20,7 @@ package org.sonar.server.pushapi.sonarlint; import java.util.Set; -import javax.servlet.AsyncContext; +import jakarta.servlet.AsyncContext; import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/server/sonar-webserver-pushapi/src/test/java/org/sonar/server/pushapi/sonarlint/SonarLintClientsRegistryTest.java b/server/sonar-webserver-pushapi/src/test/java/org/sonar/server/pushapi/sonarlint/SonarLintClientsRegistryTest.java index 3c13f92b858..270b9902232 100644 --- a/server/sonar-webserver-pushapi/src/test/java/org/sonar/server/pushapi/sonarlint/SonarLintClientsRegistryTest.java +++ b/server/sonar-webserver-pushapi/src/test/java/org/sonar/server/pushapi/sonarlint/SonarLintClientsRegistryTest.java @@ -22,9 +22,9 @@ package org.sonar.server.pushapi.sonarlint; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.Set; -import javax.servlet.AsyncContext; -import javax.servlet.ServletOutputStream; -import javax.servlet.ServletResponse; +import jakarta.servlet.AsyncContext; +import jakarta.servlet.ServletOutputStream; +import jakarta.servlet.ServletResponse; import org.junit.After; import org.junit.Before; import org.junit.Test; diff --git a/server/sonar-webserver-pushapi/src/testFixtures/java/org/sonar/server/pushapi/DumbPushResponse.java b/server/sonar-webserver-pushapi/src/testFixtures/java/org/sonar/server/pushapi/DumbPushResponse.java index 166918d17dc..6ab8c9be109 100644 --- a/server/sonar-webserver-pushapi/src/testFixtures/java/org/sonar/server/pushapi/DumbPushResponse.java +++ b/server/sonar-webserver-pushapi/src/testFixtures/java/org/sonar/server/pushapi/DumbPushResponse.java @@ -30,13 +30,13 @@ import java.util.Collection; import java.util.HashMap; import java.util.Map; import javax.annotation.CheckForNull; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.io.IOUtils; import org.sonar.api.server.http.HttpResponse; import org.sonar.api.server.ws.Response; import org.sonar.api.utils.text.JsonWriter; import org.sonar.api.utils.text.XmlWriter; -import org.sonar.server.http.JavaxHttpResponse; +import org.sonar.server.http.JakartaHttpResponse; import org.sonar.server.ws.ServletResponse; import org.sonar.server.ws.TestableResponse; @@ -50,7 +50,7 @@ public class DumbPushResponse extends ServletResponse implements TestableRespons } private static HttpResponse initMock() { - JavaxHttpResponse mock = mock(JavaxHttpResponse.class); + JakartaHttpResponse mock = mock(JakartaHttpResponse.class); when(mock.getDelegate()).thenReturn(mock(HttpServletResponse.class)); return mock; } diff --git a/server/sonar-webserver-pushapi/src/testFixtures/java/org/sonar/server/pushapi/TestPushRequest.java b/server/sonar-webserver-pushapi/src/testFixtures/java/org/sonar/server/pushapi/TestPushRequest.java index 81bce8154f8..78c0193eadb 100644 --- a/server/sonar-webserver-pushapi/src/testFixtures/java/org/sonar/server/pushapi/TestPushRequest.java +++ b/server/sonar-webserver-pushapi/src/testFixtures/java/org/sonar/server/pushapi/TestPushRequest.java @@ -22,8 +22,8 @@ package org.sonar.server.pushapi; import com.google.common.base.Throwables; import java.util.Map; import java.util.Optional; -import javax.servlet.AsyncContext; -import org.sonar.server.http.JavaxHttpRequest; +import jakarta.servlet.AsyncContext; +import org.sonar.server.http.JakartaHttpRequest; import org.sonar.server.ws.ServletRequest; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.TestResponse; @@ -35,7 +35,7 @@ public class TestPushRequest extends ServletRequest { private TestRequest testRequest = new TestRequest(); public TestPushRequest() { - super(mock(JavaxHttpRequest.class)); + super(mock(JakartaHttpRequest.class)); } @Override diff --git a/server/sonar-webserver-webapi-v2/build.gradle b/server/sonar-webserver-webapi-v2/build.gradle index 0b65a6ad13a..7e75b599c05 100644 --- a/server/sonar-webserver-webapi-v2/build.gradle +++ b/server/sonar-webserver-webapi-v2/build.gradle @@ -6,11 +6,11 @@ sonarqube { dependencies { // please keep the list grouped by configuration and ordered by name - api 'org.springdoc:springdoc-openapi-webmvc-core' + api 'org.springdoc:springdoc-openapi-starter-webmvc-api' api 'org.springframework:spring-webmvc' api 'org.hibernate.validator:hibernate-validator' api 'jakarta.el:jakarta.el-api' - api 'org.glassfish:jakarta.el' + api 'org.glassfish.expressly:expressly' api project(':server:sonar-db-dao') api project(':server:sonar-webserver-common') diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/controller/Searchable.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/controller/Searchable.java index 7a5296ea7c7..c623ca24a44 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/controller/Searchable.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/controller/Searchable.java @@ -19,11 +19,11 @@ */ package org.sonar.server.v2.api.controller; -import javax.validation.Valid; +import jakarta.validation.Valid; import org.sonar.server.v2.api.model.RestPage; import org.sonar.server.v2.api.request.RestSearchRequest; import org.sonar.server.v2.api.response.RestSearchResponse; -import org.springdoc.api.annotations.ParameterObject; +import org.springdoc.core.annotations.ParameterObject; public interface Searchable<T, U extends RestSearchRequest> { diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/email/config/controller/EmailConfigurationController.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/email/config/controller/EmailConfigurationController.java index 01eef1272c1..827477d74c6 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/email/config/controller/EmailConfigurationController.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/email/config/controller/EmailConfigurationController.java @@ -24,7 +24,7 @@ import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.extensions.Extension; import io.swagger.v3.oas.annotations.extensions.ExtensionProperty; -import javax.validation.Valid; +import jakarta.validation.Valid; import org.sonar.server.v2.api.email.config.request.EmailConfigurationCreateRestRequest; import org.sonar.server.v2.api.email.config.request.EmailConfigurationUpdateRestRequest; import org.sonar.server.v2.api.email.config.resource.EmailConfigurationResource; diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/email/config/request/EmailConfigurationCreateRestRequest.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/email/config/request/EmailConfigurationCreateRestRequest.java index 0034d8feacb..631957ecc25 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/email/config/request/EmailConfigurationCreateRestRequest.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/email/config/request/EmailConfigurationCreateRestRequest.java @@ -21,8 +21,8 @@ package org.sonar.server.v2.api.email.config.request; import io.swagger.v3.oas.annotations.media.Schema; import javax.annotation.Nullable; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; import org.sonar.server.v2.api.email.config.resource.EmailConfigurationAuthMethod; import org.sonar.server.v2.api.email.config.resource.EmailConfigurationSecurityProtocol; diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/github/config/controller/GithubConfigurationController.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/github/config/controller/GithubConfigurationController.java index eb6865db0ee..b9863468a91 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/github/config/controller/GithubConfigurationController.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/github/config/controller/GithubConfigurationController.java @@ -24,7 +24,7 @@ import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.extensions.Extension; import io.swagger.v3.oas.annotations.extensions.ExtensionProperty; -import javax.validation.Valid; +import jakarta.validation.Valid; import org.sonar.server.v2.api.github.config.request.GithubConfigurationCreateRestRequest; import org.sonar.server.v2.api.github.config.request.GithubConfigurationUpdateRestRequest; import org.sonar.server.v2.api.github.config.resource.GithubConfigurationResource; diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/github/config/request/GithubConfigurationCreateRestRequest.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/github/config/request/GithubConfigurationCreateRestRequest.java index d5cf09c7169..c4e82f98992 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/github/config/request/GithubConfigurationCreateRestRequest.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/github/config/request/GithubConfigurationCreateRestRequest.java @@ -23,8 +23,8 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; import javax.annotation.Nullable; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; import org.sonar.server.v2.api.model.ProvisioningType; public record GithubConfigurationCreateRestRequest( diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/gitlab/config/controller/GitlabConfigurationController.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/gitlab/config/controller/GitlabConfigurationController.java index 3329649d4f8..2ec2cf3f9ca 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/gitlab/config/controller/GitlabConfigurationController.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/gitlab/config/controller/GitlabConfigurationController.java @@ -24,7 +24,7 @@ import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.extensions.Extension; import io.swagger.v3.oas.annotations.extensions.ExtensionProperty; -import javax.validation.Valid; +import jakarta.validation.Valid; import org.sonar.server.v2.api.gitlab.config.request.GitlabConfigurationCreateRestRequest; import org.sonar.server.v2.api.gitlab.config.request.GitlabConfigurationUpdateRestRequest; import org.sonar.server.v2.api.gitlab.config.resource.GitlabConfigurationResource; diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/gitlab/config/request/GitlabConfigurationCreateRestRequest.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/gitlab/config/request/GitlabConfigurationCreateRestRequest.java index 837328970ed..6a8f4a28780 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/gitlab/config/request/GitlabConfigurationCreateRestRequest.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/gitlab/config/request/GitlabConfigurationCreateRestRequest.java @@ -23,8 +23,8 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; import javax.annotation.Nullable; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; import org.sonar.server.v2.api.model.ProvisioningType; public record GitlabConfigurationCreateRestRequest( diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/gitlab/config/request/GitlabConfigurationUpdateRestRequest.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/gitlab/config/request/GitlabConfigurationUpdateRestRequest.java index 57e38b911dd..3f82182b0d2 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/gitlab/config/request/GitlabConfigurationUpdateRestRequest.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/gitlab/config/request/GitlabConfigurationUpdateRestRequest.java @@ -22,7 +22,7 @@ package org.sonar.server.v2.api.gitlab.config.request; import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; -import javax.validation.constraints.Size; +import jakarta.validation.constraints.Size; import org.sonar.server.v2.api.model.ProvisioningType; import org.sonar.server.v2.common.model.UpdateField; diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/group/controller/GroupController.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/group/controller/GroupController.java index 87dadb7fa24..1e6b3917055 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/group/controller/GroupController.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/group/controller/GroupController.java @@ -22,14 +22,14 @@ package org.sonar.server.v2.api.group.controller; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.enums.ParameterIn; -import javax.validation.Valid; +import jakarta.validation.Valid; import org.sonar.server.v2.api.group.request.GroupCreateRestRequest; import org.sonar.server.v2.api.group.request.GroupUpdateRestRequest; import org.sonar.server.v2.api.group.request.GroupsSearchRestRequest; import org.sonar.server.v2.api.group.response.GroupRestResponse; import org.sonar.server.v2.api.group.response.GroupsSearchRestResponse; import org.sonar.server.v2.api.model.RestPage; -import org.springdoc.api.annotations.ParameterObject; +import org.springdoc.core.annotations.ParameterObject; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.DeleteMapping; diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/group/request/GroupCreateRestRequest.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/group/request/GroupCreateRestRequest.java index 88049db9bfe..54a6198fa6d 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/group/request/GroupCreateRestRequest.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/group/request/GroupCreateRestRequest.java @@ -21,8 +21,8 @@ package org.sonar.server.v2.api.group.request; import io.swagger.v3.oas.annotations.media.Schema; import javax.annotation.Nullable; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.Size; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.Size; import static org.sonar.api.user.UserGroupValidation.GROUP_NAME_MAX_LENGTH; diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/group/request/GroupUpdateRestRequest.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/group/request/GroupUpdateRestRequest.java index 4037e7b393d..964cf52eba2 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/group/request/GroupUpdateRestRequest.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/group/request/GroupUpdateRestRequest.java @@ -20,7 +20,7 @@ package org.sonar.server.v2.api.group.request; import io.swagger.v3.oas.annotations.media.Schema; -import javax.validation.constraints.Size; +import jakarta.validation.constraints.Size; import org.sonar.server.v2.common.model.UpdateField; import static org.sonar.api.user.UserGroupValidation.GROUP_NAME_MAX_LENGTH; diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/membership/controller/GroupMembershipController.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/membership/controller/GroupMembershipController.java index 6fdc918b8da..420d7324616 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/membership/controller/GroupMembershipController.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/membership/controller/GroupMembershipController.java @@ -22,13 +22,13 @@ package org.sonar.server.v2.api.membership.controller; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.enums.ParameterIn; -import javax.validation.Valid; +import jakarta.validation.Valid; import org.sonar.server.v2.api.membership.request.GroupMembershipCreateRestRequest; import org.sonar.server.v2.api.membership.request.GroupsMembershipSearchRestRequest; import org.sonar.server.v2.api.membership.response.GroupsMembershipSearchRestResponse; import org.sonar.server.v2.api.membership.response.GroupMembershipRestResponse; import org.sonar.server.v2.api.model.RestPage; -import org.springdoc.api.annotations.ParameterObject; +import org.springdoc.core.annotations.ParameterObject; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.DeleteMapping; diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/mode/controller/ModeController.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/mode/controller/ModeController.java index 7bd89a595cf..40d62399639 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/mode/controller/ModeController.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/mode/controller/ModeController.java @@ -22,7 +22,7 @@ package org.sonar.server.v2.api.mode.controller; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.extensions.Extension; import io.swagger.v3.oas.annotations.extensions.ExtensionProperty; -import javax.validation.Valid; +import jakarta.validation.Valid; import org.sonar.server.v2.api.mode.resources.ModeResource; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.GetMapping; diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/mode/resources/ModeResource.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/mode/resources/ModeResource.java index 90c866d150c..4839c9167a4 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/mode/resources/ModeResource.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/mode/resources/ModeResource.java @@ -20,7 +20,7 @@ package org.sonar.server.v2.api.mode.resources; import io.swagger.v3.oas.annotations.media.Schema; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotNull; import org.sonar.server.v2.api.mode.enums.ModeEnum; public record ModeResource( diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/model/RestPage.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/model/RestPage.java index 3e4aeb53e2f..87dd2c81e85 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/model/RestPage.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/model/RestPage.java @@ -21,10 +21,10 @@ package org.sonar.server.v2.api.model; import com.google.common.annotations.VisibleForTesting; import io.swagger.v3.oas.annotations.media.Schema; -import javax.validation.constraints.Max; -import javax.validation.constraints.Min; -import javax.validation.constraints.Positive; -import javax.validation.constraints.PositiveOrZero; +import jakarta.validation.constraints.Max; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.Positive; +import jakarta.validation.constraints.PositiveOrZero; import org.jetbrains.annotations.Nullable; public record RestPage( diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/projectbindings/controller/ProjectBindingsController.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/projectbindings/controller/ProjectBindingsController.java index baf77a69ddf..f2d8a119d34 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/projectbindings/controller/ProjectBindingsController.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/projectbindings/controller/ProjectBindingsController.java @@ -24,12 +24,12 @@ import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.extensions.Extension; import io.swagger.v3.oas.annotations.extensions.ExtensionProperty; -import javax.validation.Valid; +import jakarta.validation.Valid; import org.sonar.server.v2.api.model.RestPage; import org.sonar.server.v2.api.projectbindings.model.ProjectBinding; import org.sonar.server.v2.api.projectbindings.request.ProjectBindingsSearchRestRequest; import org.sonar.server.v2.api.projectbindings.response.ProjectBindingsSearchRestResponse; -import org.springdoc.api.annotations.ParameterObject; +import org.springdoc.core.annotations.ParameterObject; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/projectbindings/model/ProjectBinding.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/projectbindings/model/ProjectBinding.java index 8f7e502d5ae..772c7b43dac 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/projectbindings/model/ProjectBinding.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/projectbindings/model/ProjectBinding.java @@ -20,7 +20,7 @@ package org.sonar.server.v2.api.projectbindings.model; import javax.annotation.Nullable; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotNull; public record ProjectBinding ( diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/projects/controller/BoundProjectsController.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/projects/controller/BoundProjectsController.java index 4ae3255162e..2e095e06f51 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/projects/controller/BoundProjectsController.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/projects/controller/BoundProjectsController.java @@ -20,7 +20,7 @@ package org.sonar.server.v2.api.projects.controller; import io.swagger.v3.oas.annotations.Operation; -import javax.validation.Valid; +import jakarta.validation.Valid; import org.sonar.server.v2.api.projects.request.BoundProjectCreateRestRequest; import org.sonar.server.v2.api.projects.response.BoundProjectCreateRestResponse; import org.springframework.http.HttpStatus; diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/projects/request/BoundProjectCreateRestRequest.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/projects/request/BoundProjectCreateRestRequest.java index ce9809a3dd0..e35a4ad4e71 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/projects/request/BoundProjectCreateRestRequest.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/projects/request/BoundProjectCreateRestRequest.java @@ -21,8 +21,8 @@ package org.sonar.server.v2.api.projects.request; import io.swagger.v3.oas.annotations.media.Schema; import javax.annotation.Nullable; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; public record BoundProjectCreateRestRequest( diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/rule/controller/RuleController.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/rule/controller/RuleController.java index b73a8440d22..45ac60908dd 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/rule/controller/RuleController.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/rule/controller/RuleController.java @@ -22,7 +22,7 @@ package org.sonar.server.v2.api.rule.controller; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.extensions.Extension; import io.swagger.v3.oas.annotations.extensions.ExtensionProperty; -import javax.validation.Valid; +import jakarta.validation.Valid; import org.sonar.server.v2.api.rule.request.RuleCreateRestRequest; import org.sonar.server.v2.api.rule.response.RuleRestResponse; import org.springframework.http.HttpStatus; diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/rule/request/RuleCreateRestRequest.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/rule/request/RuleCreateRestRequest.java index 6552f28df0d..3db612d1ede 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/rule/request/RuleCreateRestRequest.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/rule/request/RuleCreateRestRequest.java @@ -22,9 +22,9 @@ package org.sonar.server.v2.api.rule.request; import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; import javax.annotation.Nullable; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import org.sonar.api.rules.RuleType; import org.sonar.server.v2.api.rule.enums.CleanCodeAttributeRestEnum; import org.sonar.server.v2.api.rule.enums.RuleStatusRestEnum; diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/user/controller/UserController.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/user/controller/UserController.java index fa189c71df1..0a3f3c42b9a 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/user/controller/UserController.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/user/controller/UserController.java @@ -25,15 +25,15 @@ import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.extensions.Extension; import io.swagger.v3.oas.annotations.extensions.ExtensionProperty; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; import javax.annotation.Nullable; -import javax.validation.Valid; import org.sonar.server.v2.api.model.RestPage; -import org.sonar.server.v2.api.user.response.UserRestResponse; import org.sonar.server.v2.api.user.request.UserCreateRestRequest; import org.sonar.server.v2.api.user.request.UserUpdateRestRequest; import org.sonar.server.v2.api.user.request.UsersSearchRestRequest; +import org.sonar.server.v2.api.user.response.UserRestResponse; import org.sonar.server.v2.api.user.response.UsersSearchRestResponse; -import org.springdoc.api.annotations.ParameterObject; +import org.springdoc.core.annotations.ParameterObject; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.DeleteMapping; diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/user/request/UserCreateRestRequest.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/user/request/UserCreateRestRequest.java index 4cb7953b936..bbf55d90dc7 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/user/request/UserCreateRestRequest.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/user/request/UserCreateRestRequest.java @@ -22,9 +22,9 @@ package org.sonar.server.v2.api.user.request; import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; import javax.annotation.Nullable; -import javax.validation.constraints.Email; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +import jakarta.validation.constraints.Email; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; public record UserCreateRestRequest( @Nullable diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/user/request/UserUpdateRestRequest.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/user/request/UserUpdateRestRequest.java index 86df618f040..00edfe89904 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/user/request/UserUpdateRestRequest.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/user/request/UserUpdateRestRequest.java @@ -23,8 +23,8 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; import javax.annotation.Nullable; -import javax.validation.constraints.Email; -import javax.validation.constraints.Size; +import jakarta.validation.constraints.Email; +import jakarta.validation.constraints.Size; import org.sonar.server.v2.common.model.UpdateField; public class UserUpdateRestRequest { diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/validation/UpdateFieldValueExtractor.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/validation/UpdateFieldValueExtractor.java index 1d78a93d708..1c23d518bf2 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/validation/UpdateFieldValueExtractor.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/validation/UpdateFieldValueExtractor.java @@ -19,9 +19,9 @@ */ package org.sonar.server.v2.api.validation; -import javax.validation.valueextraction.ExtractedValue; -import javax.validation.valueextraction.UnwrapByDefault; -import javax.validation.valueextraction.ValueExtractor; +import jakarta.validation.valueextraction.ExtractedValue; +import jakarta.validation.valueextraction.UnwrapByDefault; +import jakarta.validation.valueextraction.ValueExtractor; import org.sonar.server.v2.common.model.UpdateField; @UnwrapByDefault diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/common/DeprecatedHandler.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/common/DeprecatedHandler.java index 478d8ff5e81..a6712d8a8f5 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/common/DeprecatedHandler.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/common/DeprecatedHandler.java @@ -20,14 +20,14 @@ package org.sonar.server.v2.common; import java.lang.reflect.Field; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.event.Level; import org.sonar.server.user.ThreadLocalUserSession; import org.sonar.server.user.UserSession; -import org.springdoc.api.annotations.ParameterObject; +import org.springdoc.core.annotations.ParameterObject; import org.springframework.core.MethodParameter; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.RequestParam; diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/common/model/NullOrNotEmpty.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/common/model/NullOrNotEmpty.java index 7f69d3cad44..b2843f3379c 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/common/model/NullOrNotEmpty.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/common/model/NullOrNotEmpty.java @@ -23,8 +23,8 @@ import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import static java.lang.annotation.ElementType.ANNOTATION_TYPE; import static java.lang.annotation.ElementType.CONSTRUCTOR; diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/common/model/NullOrNotEmptyValidator.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/common/model/NullOrNotEmptyValidator.java index b6a40c694d0..ce137a0ca02 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/common/model/NullOrNotEmptyValidator.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/common/model/NullOrNotEmptyValidator.java @@ -20,8 +20,8 @@ package org.sonar.server.v2.common.model; import javax.annotation.Nullable; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; public class NullOrNotEmptyValidator implements ConstraintValidator<NullOrNotEmpty, String> { @Override diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/common/model/UpdateField.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/common/model/UpdateField.java index 9f4a942cf47..232a878ab12 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/common/model/UpdateField.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/common/model/UpdateField.java @@ -23,7 +23,7 @@ import java.util.function.Consumer; import java.util.function.Function; import javax.annotation.CheckForNull; import javax.annotation.Nullable; -import javax.validation.valueextraction.UnwrapByDefault; +import jakarta.validation.valueextraction.UnwrapByDefault; import org.sonar.server.common.NonNullUpdatedValue; import org.sonar.server.common.UpdatedValue; diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/config/CommonWebConfig.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/config/CommonWebConfig.java index 3ba5ee6eb43..273d665e93f 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/config/CommonWebConfig.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/config/CommonWebConfig.java @@ -22,7 +22,7 @@ package org.sonar.server.v2.config; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.info.Info; import org.sonar.server.v2.common.RestResponseEntityExceptionHandler; -import org.springdoc.core.SpringDocConfigProperties; +import org.springdoc.core.properties.SpringDocConfigProperties; import org.springframework.beans.factory.config.BeanFactoryPostProcessor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -45,7 +45,7 @@ public class CommonWebConfig implements WebMvcConfigurer { public void configurePathMatch(PathMatchConfigurer configurer) { UrlPathHelper urlPathHelper = new UrlPathHelper(); urlPathHelper.setUrlDecode(false); - configurer.setUrlPathHelper(urlPathHelper); + configurer.setUrlPathHelper(urlPathHelper).setUseTrailingSlashMatch(true); } @Bean diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/config/SafeModeWebConfig.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/config/SafeModeWebConfig.java index f235bd848b3..ca682d0638e 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/config/SafeModeWebConfig.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/config/SafeModeWebConfig.java @@ -20,9 +20,7 @@ package org.sonar.server.v2.config; import org.sonar.db.Database; -import org.sonar.server.common.health.DbConnectionNodeCheck; import org.sonar.server.common.platform.LivenessChecker; -import org.sonar.server.common.platform.SafeModeLivenessCheckerImpl; import org.sonar.server.health.HealthChecker; import org.sonar.server.platform.db.migration.DatabaseMigrationState; import org.sonar.server.platform.db.migration.version.DatabaseVersion; @@ -42,11 +40,6 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc; public class SafeModeWebConfig { @Bean - public LivenessChecker livenessChecker(DbConnectionNodeCheck dbConnectionNodeCheck) { - return new SafeModeLivenessCheckerImpl(dbConnectionNodeCheck); - } - - @Bean public LivenessController livenessController(LivenessChecker livenessChecker, SystemPasscode systemPasscode) { return new DefaultLivenessController(livenessChecker, systemPasscode, null); } diff --git a/server/sonar-webserver-webapi-v2/src/test/java/org/sonar/server/v2/common/DeprecatedHandlerTest.java b/server/sonar-webserver-webapi-v2/src/test/java/org/sonar/server/v2/common/DeprecatedHandlerTest.java index 767349b6b96..1cd39f6b6e1 100644 --- a/server/sonar-webserver-webapi-v2/src/test/java/org/sonar/server/v2/common/DeprecatedHandlerTest.java +++ b/server/sonar-webserver-webapi-v2/src/test/java/org/sonar/server/v2/common/DeprecatedHandlerTest.java @@ -23,8 +23,8 @@ import com.tngtech.java.junit.dataprovider.DataProvider; import com.tngtech.java.junit.dataprovider.DataProviderRunner; import com.tngtech.java.junit.dataprovider.UseDataProvider; import java.util.List; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -32,7 +32,7 @@ import org.slf4j.event.Level; import org.sonar.api.testfixtures.log.LogTester; import org.sonar.server.user.ThreadLocalUserSession; import org.sonar.server.v2.api.ControllerTester; -import org.springdoc.api.annotations.ParameterObject; +import org.springdoc.core.annotations.ParameterObject; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.test.web.servlet.MockMvc; diff --git a/server/sonar-webserver-webapi-v2/src/test/java/org/sonar/server/v2/common/model/NullOrNotEmptyValidatorTest.java b/server/sonar-webserver-webapi-v2/src/test/java/org/sonar/server/v2/common/model/NullOrNotEmptyValidatorTest.java index 2b9799bda63..7ac4bb59667 100644 --- a/server/sonar-webserver-webapi-v2/src/test/java/org/sonar/server/v2/common/model/NullOrNotEmptyValidatorTest.java +++ b/server/sonar-webserver-webapi-v2/src/test/java/org/sonar/server/v2/common/model/NullOrNotEmptyValidatorTest.java @@ -19,7 +19,7 @@ */ package org.sonar.server.v2.common.model; -import javax.validation.ConstraintValidatorContext; +import jakarta.validation.ConstraintValidatorContext; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; @@ -46,4 +46,4 @@ class NullOrNotEmptyValidatorTest { assertFalse(validator.isValid("", context)); } -}
\ No newline at end of file +} diff --git a/server/sonar-webserver-webapi-v2/src/testFixtures/java/org/sonar/server/v2/api/ControllerTester.java b/server/sonar-webserver-webapi-v2/src/testFixtures/java/org/sonar/server/v2/api/ControllerTester.java index 46a2df1a9c3..8a63eaaedc7 100644 --- a/server/sonar-webserver-webapi-v2/src/testFixtures/java/org/sonar/server/v2/api/ControllerTester.java +++ b/server/sonar-webserver-webapi-v2/src/testFixtures/java/org/sonar/server/v2/api/ControllerTester.java @@ -36,6 +36,7 @@ public class ControllerTester { .standaloneSetup(controllers) .setCustomHandlerMapping(() -> resolveRequestMappingHandlerMapping(handlerInterceptors)) .setControllerAdvice(new RestResponseEntityExceptionHandler()) + .setUseTrailingSlashPatternMatch(true) .build(); } diff --git a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/user/ws/ChangePasswordActionIT.java b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/user/ws/ChangePasswordActionIT.java index 4439dc5ca8a..5650b35f9b0 100644 --- a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/user/ws/ChangePasswordActionIT.java +++ b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/user/ws/ChangePasswordActionIT.java @@ -22,8 +22,8 @@ package org.sonar.server.user.ws; import java.io.IOException; import java.util.Optional; import javax.annotation.Nullable; -import javax.servlet.ServletOutputStream; -import javax.servlet.WriteListener; +import jakarta.servlet.ServletOutputStream; +import jakarta.servlet.WriteListener; import org.junit.Before; import org.junit.Rule; import org.junit.Test; diff --git a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/user/ws/SetHomepageActionIT.java b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/user/ws/SetHomepageActionIT.java index 58def6da21e..322a6366180 100644 --- a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/user/ws/SetHomepageActionIT.java +++ b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/user/ws/SetHomepageActionIT.java @@ -32,7 +32,7 @@ import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.TestResponse; import org.sonar.server.ws.WsActionTester; -import static javax.servlet.http.HttpServletResponse.SC_NO_CONTENT; +import static jakarta.servlet.http.HttpServletResponse.SC_NO_CONTENT; import static org.apache.commons.lang3.RandomStringUtils.secure; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/github/config/CheckAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/github/config/CheckAction.java index aab60b36d18..1575bb6aeea 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/github/config/CheckAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/github/config/CheckAction.java @@ -21,7 +21,7 @@ package org.sonar.server.almintegration.ws.github.config; import com.google.gson.GsonBuilder; import java.nio.charset.StandardCharsets; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.sonar.alm.client.github.config.ConfigCheckResult; import org.sonar.alm.client.github.config.GithubProvisioningConfigValidator; import org.sonar.api.server.ServerSide; diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/email/ws/SendAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/email/ws/SendAction.java index d84e9080dcc..34e16847675 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/email/ws/SendAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/email/ws/SendAction.java @@ -19,7 +19,7 @@ */ package org.sonar.server.email.ws; -import org.apache.commons.mail.EmailException; +import org.apache.commons.mail2.core.EmailException; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/LivenessActionSupport.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/LivenessActionSupport.java index 85890a0e011..541e24d5a26 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/LivenessActionSupport.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/LivenessActionSupport.java @@ -19,7 +19,7 @@ */ package org.sonar.server.platform.ws; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.sonar.api.server.ws.Change; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/saml/ws/ValidationAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/saml/ws/ValidationAction.java index 8e7561d6143..b12645e0337 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/saml/ws/ValidationAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/saml/ws/ValidationAction.java @@ -22,8 +22,8 @@ package org.sonar.server.saml.ws; import java.io.IOException; import java.util.Arrays; import java.util.stream.Collectors; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletRequestWrapper; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequestWrapper; import org.sonar.api.server.http.HttpRequest; import org.sonar.api.server.http.HttpResponse; import org.sonar.api.server.ws.WebService; @@ -38,7 +38,7 @@ import org.sonar.server.authentication.OAuthCsrfVerifier; import org.sonar.server.authentication.SamlValidationCspHeaders; import org.sonar.server.authentication.SamlValidationRedirectionFilter; import org.sonar.server.authentication.event.AuthenticationException; -import org.sonar.server.http.JavaxHttpRequest; +import org.sonar.server.http.JakartaHttpRequest; import org.sonar.server.user.ThreadLocalUserSession; import org.sonar.server.ws.ServletFilterHandler; @@ -82,7 +82,7 @@ public class ValidationAction extends HttpFilter implements SamlAction { return; } - HttpServletRequest httpRequest = new HttpServletRequestWrapper(((JavaxHttpRequest) request).getDelegate()) { + HttpServletRequest httpRequest = new HttpServletRequestWrapper(((JakartaHttpRequest) request).getDelegate()) { @Override public StringBuffer getRequestURL() { return new StringBuffer(oAuth2ContextFactory.generateCallbackUrl(SamlIdentityProvider.KEY)); @@ -91,7 +91,7 @@ public class ValidationAction extends HttpFilter implements SamlAction { response.setContentType("text/html"); - String htmlResponse = samlAuthenticator.getAuthenticationStatusPage(new JavaxHttpRequest(httpRequest), response); + String htmlResponse = samlAuthenticator.getAuthenticationStatusPage(new JakartaHttpRequest(httpRequest), response); String nonce = SamlValidationCspHeaders.addCspHeadersWithNonceToResponse(response); htmlResponse = htmlResponse.replace("%NONCE%", nonce); response.getWriter().print(htmlResponse); diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/EmailValidator.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/EmailValidator.java index 3325e90405a..751bcdc859d 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/EmailValidator.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/EmailValidator.java @@ -19,9 +19,9 @@ */ package org.sonar.server.user.ws; +import jakarta.mail.internet.AddressException; +import jakarta.mail.internet.InternetAddress; import javax.annotation.Nullable; -import javax.mail.internet.AddressException; -import javax.mail.internet.InternetAddress; import static org.apache.commons.lang3.StringUtils.isEmpty; diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/saml/ws/ValidationActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/saml/ws/ValidationActionTest.java index 07ee47ccbd1..520128081bb 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/saml/ws/ValidationActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/saml/ws/ValidationActionTest.java @@ -23,8 +23,8 @@ import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; import java.util.List; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.junit.Before; import org.junit.Test; import org.sonar.api.server.http.HttpRequest; @@ -37,8 +37,8 @@ import org.sonar.server.authentication.OAuth2ContextFactory; import org.sonar.server.authentication.OAuthCsrfVerifier; import org.sonar.server.authentication.event.AuthenticationEvent; import org.sonar.server.authentication.event.AuthenticationException; -import org.sonar.server.http.JavaxHttpRequest; -import org.sonar.server.http.JavaxHttpResponse; +import org.sonar.server.http.JakartaHttpRequest; +import org.sonar.server.http.JakartaHttpResponse; import org.sonar.server.user.ThreadLocalUserSession; import static org.assertj.core.api.Assertions.assertThat; @@ -94,7 +94,7 @@ public class ValidationActionTest { final String mockedHtmlContent = "mocked html content"; doReturn(mockedHtmlContent).when(samlAuthenticator).getAuthenticationStatusPage(any(), any()); - underTest.doFilter(new JavaxHttpRequest(servletRequest), new JavaxHttpResponse(servletResponse), filterChain); + underTest.doFilter(new JakartaHttpRequest(servletRequest), new JakartaHttpResponse(servletResponse), filterChain); verify(samlAuthenticator).getAuthenticationStatusPage(any(), any()); verify(servletResponse).getWriter(); diff --git a/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/RequestVerifier.java b/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/RequestVerifier.java index dbb6b38990a..2b5f3f05666 100644 --- a/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/RequestVerifier.java +++ b/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/RequestVerifier.java @@ -23,7 +23,7 @@ import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.WebService; import org.sonar.server.exceptions.ServerException; -import static javax.servlet.http.HttpServletResponse.SC_METHOD_NOT_ALLOWED; +import static jakarta.servlet.http.HttpServletResponse.SC_METHOD_NOT_ALLOWED; public class RequestVerifier { private RequestVerifier() { diff --git a/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/ServletRequest.java b/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/ServletRequest.java index 35843e51cfe..15e1148af39 100644 --- a/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/ServletRequest.java +++ b/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/ServletRequest.java @@ -30,13 +30,13 @@ import java.util.List; import java.util.Map; import java.util.Optional; import javax.annotation.CheckForNull; -import javax.servlet.AsyncContext; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.AsyncContext; +import jakarta.servlet.http.HttpServletRequest; import org.sonar.api.impl.ws.PartImpl; import org.sonar.api.impl.ws.ValidatingRequest; import org.sonar.api.server.http.HttpRequest; import org.slf4j.LoggerFactory; -import org.sonar.server.http.JavaxHttpRequest; +import org.sonar.server.http.JakartaHttpRequest; import org.sonarqube.ws.MediaTypes; import static com.google.common.base.MoreObjects.firstNonNull; @@ -54,7 +54,7 @@ public class ServletRequest extends ValidatingRequest { private final HttpServletRequest source; public ServletRequest(HttpRequest source) { - this.source = ((JavaxHttpRequest) source).getDelegate(); + this.source = ((JakartaHttpRequest) source).getDelegate(); } @Override @@ -114,7 +114,7 @@ public class ServletRequest extends ValidatingRequest { if (!isMultipartContent()) { return null; } - javax.servlet.http.Part part = source.getPart(key); + jakarta.servlet.http.Part part = source.getPart(key); if (part == null || part.getSize() == 0) { return null; } diff --git a/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/ServletResponse.java b/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/ServletResponse.java index 97761af2fec..300163226d8 100644 --- a/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/ServletResponse.java +++ b/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/ServletResponse.java @@ -24,12 +24,12 @@ import java.io.OutputStream; import java.io.OutputStreamWriter; import java.nio.charset.StandardCharsets; import java.util.Collection; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.sonar.api.server.http.HttpResponse; import org.sonar.api.server.ws.Response; import org.sonar.api.utils.text.JsonWriter; import org.sonar.api.utils.text.XmlWriter; -import org.sonar.server.http.JavaxHttpResponse; +import org.sonar.server.http.JakartaHttpResponse; import static java.nio.charset.StandardCharsets.UTF_8; import static org.sonarqube.ws.MediaTypes.JSON; @@ -40,7 +40,7 @@ public class ServletResponse implements Response { private final ServletStream stream; public ServletResponse(HttpResponse response) { - HttpServletResponse httpServletResponse = ((JavaxHttpResponse) response).getDelegate(); + HttpServletResponse httpServletResponse = ((JakartaHttpResponse) response).getDelegate(); stream = new ServletStream(httpServletResponse); } diff --git a/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/ServletRequestTest.java b/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/ServletRequestTest.java index d64a08b0f73..8f7d0da1c9a 100644 --- a/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/ServletRequestTest.java +++ b/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/ServletRequestTest.java @@ -26,10 +26,10 @@ import java.io.InputStream; import java.io.StringReader; import java.util.List; import java.util.Map; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.Part; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.Part; import org.junit.Test; -import org.sonar.server.http.JavaxHttpRequest; +import org.sonar.server.http.JakartaHttpRequest; import org.sonarqube.ws.MediaTypes; import static org.assertj.core.api.Assertions.assertThat; @@ -42,7 +42,7 @@ public class ServletRequestTest { private final HttpServletRequest source = mock(HttpServletRequest.class); - private final ServletRequest underTest = new ServletRequest(new JavaxHttpRequest(source)); + private final ServletRequest underTest = new ServletRequest(new JakartaHttpRequest(source)); @Test public void call_method() { @@ -77,7 +77,7 @@ public class ServletRequestTest { @Test public void has_param_from_source() { when(source.getParameterMap()).thenReturn(Map.of("param", new String[] {"value"})); - ServletRequest request = new ServletRequest(new JavaxHttpRequest(source)); + ServletRequest request = new ServletRequest(new JakartaHttpRequest(source)); assertThat(request.hasParam("param")).isTrue(); } diff --git a/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/ServletResponseTest.java b/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/ServletResponseTest.java index b5f754018b3..e2f8426b6ef 100644 --- a/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/ServletResponseTest.java +++ b/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/ServletResponseTest.java @@ -20,11 +20,11 @@ package org.sonar.server.ws; import java.io.IOException; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletOutputStream; +import jakarta.servlet.http.HttpServletResponse; import org.junit.Before; import org.junit.Test; -import org.sonar.server.http.JavaxHttpResponse; +import org.sonar.server.http.JakartaHttpResponse; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; @@ -39,7 +39,7 @@ public class ServletResponseTest { private final ServletOutputStream output = mock(ServletOutputStream.class); private final HttpServletResponse response = mock(HttpServletResponse.class); - private final ServletResponse underTest = new ServletResponse(new JavaxHttpResponse(response)); + private final ServletResponse underTest = new ServletResponse(new JakartaHttpResponse(response)); @Before public void setUp() throws Exception { diff --git a/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/WebServiceEngineTest.java b/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/WebServiceEngineTest.java index 84d54757adf..001113472f0 100644 --- a/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/WebServiceEngineTest.java +++ b/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/WebServiceEngineTest.java @@ -23,7 +23,7 @@ import com.tngtech.java.junit.dataprovider.DataProvider; import com.tngtech.java.junit.dataprovider.DataProviderRunner; import com.tngtech.java.junit.dataprovider.UseDataProvider; import java.util.function.Consumer; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.apache.catalina.connector.ClientAbortException; import org.junit.Before; import org.junit.Rule; diff --git a/server/sonar-webserver/build.gradle b/server/sonar-webserver/build.gradle index 9a0e7599971..1850493c986 100644 --- a/server/sonar-webserver/build.gradle +++ b/server/sonar-webserver/build.gradle @@ -11,6 +11,7 @@ dependencies { api 'com.google.guava:guava' api 'org.apache.tomcat.embed:tomcat-embed-core' + api 'ch.qos.logback.access:logback-access-tomcat' api project(':sonar-core') api project(':server:sonar-auth-bitbucket') api project(':server:sonar-auth-github') diff --git a/server/sonar-webserver/src/it/java/org/sonar/server/platform/web/EndpointPathFilterTest.java b/server/sonar-webserver/src/it/java/org/sonar/server/platform/web/EndpointPathFilterTest.java index e9fe8e170c9..88eb4e5683d 100644 --- a/server/sonar-webserver/src/it/java/org/sonar/server/platform/web/EndpointPathFilterTest.java +++ b/server/sonar-webserver/src/it/java/org/sonar/server/platform/web/EndpointPathFilterTest.java @@ -20,11 +20,11 @@ package org.sonar.server.platform.web; import java.io.IOException; -import javax.servlet.FilterChain; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.junit.Before; import org.junit.Test; import org.slf4j.MDC; diff --git a/server/sonar-webserver/src/it/java/org/sonar/server/platform/web/SonarLintConnectionFilterIT.java b/server/sonar-webserver/src/it/java/org/sonar/server/platform/web/SonarLintConnectionFilterIT.java index 537637c621d..9fb8001ac4d 100644 --- a/server/sonar-webserver/src/it/java/org/sonar/server/platform/web/SonarLintConnectionFilterIT.java +++ b/server/sonar-webserver/src/it/java/org/sonar/server/platform/web/SonarLintConnectionFilterIT.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.web; import java.io.IOException; import javax.annotation.CheckForNull; import javax.annotation.Nullable; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.junit.Rule; import org.junit.Test; import org.sonar.api.impl.utils.TestSystem2; @@ -30,7 +30,7 @@ import org.sonar.api.server.http.HttpResponse; import org.sonar.api.web.FilterChain; import org.sonar.db.DbTester; import org.sonar.db.user.UserDto; -import org.sonar.server.http.JavaxHttpRequest; +import org.sonar.server.http.JakartaHttpRequest; import org.sonar.server.user.ServerUserSession; import org.sonar.server.user.ThreadLocalUserSession; @@ -98,7 +98,7 @@ public class SonarLintConnectionFilterIT { HttpServletRequest httpRequest = mock(HttpServletRequest.class); when(httpRequest.getHeader("User-Agent")).thenReturn("sonarlint"); FilterChain chain = mock(FilterChain.class); - underTest.doFilter(new JavaxHttpRequest(httpRequest), mock(HttpResponse.class), chain); + underTest.doFilter(new JakartaHttpRequest(httpRequest), mock(HttpResponse.class), chain); verify(chain).doFilter(any(), any()); } @@ -128,7 +128,7 @@ public class SonarLintConnectionFilterIT { HttpServletRequest httpRequest = mock(HttpServletRequest.class); when(httpRequest.getHeader("User-Agent")).thenReturn(agent); FilterChain chain = mock(FilterChain.class); - underTest.doFilter(new JavaxHttpRequest(httpRequest), mock(HttpResponse.class), chain); + underTest.doFilter(new JakartaHttpRequest(httpRequest), mock(HttpResponse.class), chain); verify(chain).doFilter(any(), any()); } } diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/app/NullJarScanner.java b/server/sonar-webserver/src/main/java/org/sonar/server/app/NullJarScanner.java index 4b904088aa1..a3461ca4e56 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/app/NullJarScanner.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/app/NullJarScanner.java @@ -19,22 +19,22 @@ */ package org.sonar.server.app; +import jakarta.servlet.ServletContext; import org.apache.tomcat.JarScanFilter; import org.apache.tomcat.JarScanType; import org.apache.tomcat.JarScanner; import org.apache.tomcat.JarScannerCallback; -import javax.servlet.ServletContext; - /** * Disable taglib and web-fragment.xml scanning of Tomcat. Should speed up startup. */ class NullJarScanner implements JarScanner { + @Override public void scan(JarScanType jarScanType, ServletContext servletContext, JarScannerCallback jarScannerCallback) { - // doing nothing is fast! + } @Override diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/app/SecureErrorReportValve.java b/server/sonar-webserver/src/main/java/org/sonar/server/app/SecureErrorReportValve.java index 9c0807df7c5..a5c62762720 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/app/SecureErrorReportValve.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/app/SecureErrorReportValve.java @@ -20,7 +20,7 @@ package org.sonar.server.app; import java.io.IOException; -import javax.servlet.ServletException; +import jakarta.servlet.ServletException; import org.apache.catalina.connector.Request; import org.apache.catalina.connector.Response; import org.apache.catalina.valves.ErrorReportValve; diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/app/TomcatAccessLog.java b/server/sonar-webserver/src/main/java/org/sonar/server/app/TomcatAccessLog.java index 8690422eef0..04a40f5e35d 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/app/TomcatAccessLog.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/app/TomcatAccessLog.java @@ -19,7 +19,7 @@ */ package org.sonar.server.app; -import ch.qos.logback.access.PatternLayoutEncoder; +import ch.qos.logback.access.common.PatternLayoutEncoder; import ch.qos.logback.core.FileAppender; import org.apache.catalina.LifecycleEvent; import org.apache.catalina.LifecycleListener; diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/PlatformImpl.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/PlatformImpl.java index 28821f02993..3c78d45c015 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/PlatformImpl.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/platform/PlatformImpl.java @@ -24,8 +24,8 @@ import java.util.Collection; import java.util.List; import java.util.Properties; import javax.annotation.Nullable; -import javax.servlet.ServletContext; -import javax.servlet.ServletRegistration; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletRegistration; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; import org.sonar.api.utils.log.Profiler; diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/ApiV2Servlet.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/ApiV2Servlet.java index 13bce63f780..40d3184f9cf 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/ApiV2Servlet.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/ApiV2Servlet.java @@ -23,12 +23,12 @@ import com.google.common.annotations.VisibleForTesting; import java.io.IOException; import java.util.concurrent.CountDownLatch; import java.util.function.Function; -import javax.servlet.Servlet; -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.sonar.server.platform.platformlevel.PlatformLevel; import org.sonar.server.v2.config.PlatformLevel4WebConfig; import org.sonar.server.v2.config.SafeModeWebConfig; diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/CacheControlFilter.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/CacheControlFilter.java index c4e45de539a..f5a78f717af 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/CacheControlFilter.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/CacheControlFilter.java @@ -22,14 +22,14 @@ package org.sonar.server.platform.web; import com.google.common.collect.ImmutableMap; import java.io.IOException; import java.util.Map; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import static java.lang.String.format; diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/CspFilter.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/CspFilter.java index 2a6372101d9..c1095228fbf 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/CspFilter.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/CspFilter.java @@ -26,13 +26,13 @@ import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Base64; import java.util.List; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletResponse; public class CspFilter implements Filter { diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/EndpointPathFilter.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/EndpointPathFilter.java index 10294339d34..73f1a2043d5 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/EndpointPathFilter.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/EndpointPathFilter.java @@ -20,13 +20,13 @@ package org.sonar.server.platform.web; import java.io.IOException; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; import org.sonar.server.platform.web.logging.EntrypointMDCStorage; public class EndpointPathFilter implements Filter { diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/MasterServletFilter.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/MasterServletFilter.java index 1e6fe58235d..d3c3159dcab 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/MasterServletFilter.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/MasterServletFilter.java @@ -28,21 +28,21 @@ import java.util.LinkedList; import java.util.List; import javax.annotation.CheckForNull; import javax.annotation.Nullable; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.sonar.api.server.http.HttpRequest; import org.sonar.api.server.http.HttpResponse; import org.slf4j.LoggerFactory; import org.sonar.api.web.HttpFilter; -import org.sonar.server.http.JavaxHttpRequest; -import org.sonar.server.http.JavaxHttpResponse; +import org.sonar.server.http.JakartaHttpRequest; +import org.sonar.server.http.JakartaHttpResponse; import org.sonar.server.platform.PlatformImpl; /** @@ -186,8 +186,8 @@ public class MasterServletFilter implements Filter { @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException { - HttpRequest javaxHttpRequest = new JavaxHttpRequest((HttpServletRequest) servletRequest); - HttpResponse javaxHttpResponse = new JavaxHttpResponse((HttpServletResponse) servletResponse); + HttpRequest javaxHttpRequest = new JakartaHttpRequest((HttpServletRequest) servletRequest); + HttpResponse javaxHttpResponse = new JakartaHttpResponse((HttpServletResponse) servletResponse); httpFilter.doFilter(javaxHttpRequest, javaxHttpResponse, new HttpFilterChainAdapter(chain)); } } @@ -202,7 +202,7 @@ public class MasterServletFilter implements Filter { @Override public void doFilter(HttpRequest httpRequest, HttpResponse httpResponse) throws IOException { try { - filterChain.doFilter(((JavaxHttpRequest) httpRequest).getDelegate(), ((JavaxHttpResponse) httpResponse).getDelegate()); + filterChain.doFilter(((JakartaHttpRequest) httpRequest).getDelegate(), ((JakartaHttpResponse) httpResponse).getDelegate()); } catch (ServletException e) { throw new RuntimeException(e); } diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/PlatformServletContextListener.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/PlatformServletContextListener.java index 41562c6d656..6b6c6967341 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/PlatformServletContextListener.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/PlatformServletContextListener.java @@ -21,9 +21,9 @@ package org.sonar.server.platform.web; import java.util.Enumeration; import java.util.Properties; -import javax.servlet.ServletContext; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletContextEvent; +import jakarta.servlet.ServletContextListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.server.platform.PlatformImpl; diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/RedirectFilter.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/RedirectFilter.java index b79af5c6935..043e51cd965 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/RedirectFilter.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/RedirectFilter.java @@ -23,14 +23,14 @@ import java.io.IOException; import java.util.List; import java.util.function.Function; import java.util.function.Predicate; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import static java.lang.String.format; diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/RequestIdFilter.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/RequestIdFilter.java index 8346836e476..fe120621787 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/RequestIdFilter.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/RequestIdFilter.java @@ -21,12 +21,12 @@ package org.sonar.server.platform.web; import com.google.common.annotations.VisibleForTesting; import java.io.IOException; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; import org.sonar.server.platform.Platform; import org.sonar.server.platform.PlatformImpl; import org.sonar.server.platform.web.requestid.RequestIdGenerator; diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/SecurityServletFilter.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/SecurityServletFilter.java index ce0687a7011..3a5f3a16394 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/SecurityServletFilter.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/SecurityServletFilter.java @@ -21,14 +21,14 @@ package org.sonar.server.platform.web; import java.io.IOException; import java.util.Set; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; /** * This servlet filter sets response headers that enable browser protection against several classes if Web attacks. diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/StaticResourcesServlet.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/StaticResourcesServlet.java index dcb6755bcc5..4269c064efa 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/StaticResourcesServlet.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/StaticResourcesServlet.java @@ -24,9 +24,9 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import javax.annotation.CheckForNull; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.apache.catalina.connector.ClientAbortException; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; @@ -38,8 +38,8 @@ import org.sonar.server.platform.PlatformImpl; import org.sonarqube.ws.MediaTypes; import static java.lang.String.format; -import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR; -import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND; +import static jakarta.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR; +import static jakarta.servlet.http.HttpServletResponse.SC_NOT_FOUND; public class StaticResourcesServlet extends HttpServlet { diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/UserSessionFilter.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/UserSessionFilter.java index cfba1572027..2d2f6c8913b 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/UserSessionFilter.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/UserSessionFilter.java @@ -22,20 +22,20 @@ package org.sonar.server.platform.web; import com.google.common.annotations.VisibleForTesting; import java.io.IOException; import javax.annotation.Nullable; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.db.DBSessions; import org.sonar.server.authentication.UserSessionInitializer; -import org.sonar.server.http.JavaxHttpRequest; -import org.sonar.server.http.JavaxHttpResponse; +import org.sonar.server.http.JakartaHttpRequest; +import org.sonar.server.http.JakartaHttpResponse; import org.sonar.server.platform.Platform; import org.sonar.server.platform.PlatformImpl; import org.sonar.server.setting.ThreadLocalSettings; @@ -79,7 +79,7 @@ public class UserSessionFilter implements Filter { private static void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain, @Nullable UserSessionInitializer userSessionInitializer) throws IOException, ServletException { try { - if (userSessionInitializer == null || userSessionInitializer.initUserSession(new JavaxHttpRequest(request), new JavaxHttpResponse(response))) { + if (userSessionInitializer == null || userSessionInitializer.initUserSession(new JakartaHttpRequest(request), new JakartaHttpResponse(response))) { chain.doFilter(request, response); } } finally { diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/WebPagesCache.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/WebPagesCache.java index 7bd6929d18e..4018b11e4d4 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/WebPagesCache.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/WebPagesCache.java @@ -24,7 +24,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Objects; import java.util.Set; -import javax.servlet.ServletContext; +import jakarta.servlet.ServletContext; import org.apache.commons.io.IOUtils; import org.sonar.server.platform.OfficialDistribution; import org.sonar.server.platform.Platform; diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/WebPagesFilter.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/WebPagesFilter.java index 7738429dd79..26d7cea175b 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/WebPagesFilter.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/WebPagesFilter.java @@ -21,14 +21,14 @@ package org.sonar.server.platform.web; import com.google.common.annotations.VisibleForTesting; import java.io.IOException; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.sonar.api.web.UrlPattern; import org.sonar.server.platform.PlatformImpl; diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/app/NullJarScannerTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/app/NullJarScannerTest.java index 871fcbf26a1..b7919b17bdd 100644 --- a/server/sonar-webserver/src/test/java/org/sonar/server/app/NullJarScannerTest.java +++ b/server/sonar-webserver/src/test/java/org/sonar/server/app/NullJarScannerTest.java @@ -24,7 +24,7 @@ import org.apache.tomcat.JarScanType; import org.apache.tomcat.JarScannerCallback; import org.junit.Test; -import javax.servlet.ServletContext; +import jakarta.servlet.ServletContext; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/app/SecurityErrorReportValveTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/app/SecurityErrorReportValveTest.java index 1ab54b7902d..d2d8b10f2da 100644 --- a/server/sonar-webserver/src/test/java/org/sonar/server/app/SecurityErrorReportValveTest.java +++ b/server/sonar-webserver/src/test/java/org/sonar/server/app/SecurityErrorReportValveTest.java @@ -20,7 +20,7 @@ package org.sonar.server.app; import java.io.IOException; -import javax.servlet.ServletException; +import jakarta.servlet.ServletException; import org.apache.catalina.connector.Request; import org.apache.catalina.connector.Response; import org.apache.catalina.valves.ValveBase; diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/ApiV2ServletTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/ApiV2ServletTest.java index a9537fc4c0c..a26107c140c 100644 --- a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/ApiV2ServletTest.java +++ b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/ApiV2ServletTest.java @@ -20,18 +20,18 @@ package org.sonar.server.platform.web; import java.io.IOException; -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.junit.Test; import org.sonar.core.platform.SpringComponentContainer; import org.sonar.server.platform.platformlevel.PlatformLevel; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.web.servlet.DispatcherServlet; -import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND; +import static jakarta.servlet.http.HttpServletResponse.SC_NOT_FOUND; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.Mockito.doThrow; diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/CacheControlFilterTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/CacheControlFilterTest.java index ee205847004..4c52962e4f2 100644 --- a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/CacheControlFilterTest.java +++ b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/CacheControlFilterTest.java @@ -19,9 +19,9 @@ */ package org.sonar.server.platform.web; -import javax.servlet.FilterChain; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.FilterChain; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.junit.Test; import static java.lang.String.format; diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/CspFilterTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/CspFilterTest.java index 5cf592360a4..85fd3abc1bf 100644 --- a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/CspFilterTest.java +++ b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/CspFilterTest.java @@ -19,12 +19,12 @@ */ package org.sonar.server.platform.web; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.junit.Before; import org.junit.Test; diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/MasterServletFilterTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/MasterServletFilterTest.java index def2f8d1438..ed311f003e3 100644 --- a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/MasterServletFilterTest.java +++ b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/MasterServletFilterTest.java @@ -22,12 +22,12 @@ package org.sonar.server.platform.web; import java.io.IOException; import java.util.Collections; import java.util.List; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; @@ -38,8 +38,8 @@ import org.sonar.api.server.http.HttpRequest; import org.sonar.api.server.http.HttpResponse; import org.sonar.api.testfixtures.log.LogTesterJUnit5; import org.sonar.api.web.HttpFilter; -import org.sonar.server.http.JavaxHttpRequest; -import org.sonar.server.http.JavaxHttpResponse; +import org.sonar.server.http.JakartaHttpRequest; +import org.sonar.server.http.JakartaHttpResponse; import static java.util.Arrays.asList; import static java.util.Collections.singletonList; @@ -118,8 +118,8 @@ public class MasterServletFilterTest { when(request.getRequestURI()).thenReturn(scimPath); when(request.getContextPath()).thenReturn(""); - HttpRequest httpRequest = mock(JavaxHttpRequest.class); - HttpResponse httpResponse = mock(JavaxHttpResponse.class); + HttpRequest httpRequest = mock(JakartaHttpRequest.class); + HttpResponse httpResponse = mock(JakartaHttpResponse.class); when(httpRequest.getRequestURI()).thenReturn(scimPath); when(httpRequest.getContextPath()).thenReturn(""); diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/RedirectFilterTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/RedirectFilterTest.java index 422d3d8ed31..39187d5a779 100644 --- a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/RedirectFilterTest.java +++ b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/RedirectFilterTest.java @@ -21,10 +21,10 @@ package org.sonar.server.platform.web; import java.io.IOException; import javax.annotation.Nullable; -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 org.junit.Before; import org.junit.Test; diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/RequestIdFilterTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/RequestIdFilterTest.java index 8761754abcd..88940780e9f 100644 --- a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/RequestIdFilterTest.java +++ b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/RequestIdFilterTest.java @@ -21,10 +21,10 @@ package org.sonar.server.platform.web; import java.io.IOException; import java.util.Optional; -import javax.servlet.FilterChain; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; import org.junit.Before; import org.junit.Test; import org.slf4j.MDC; diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/SecurityServletFilterTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/SecurityServletFilterTest.java index 500deeb7e5e..89b6273a9e4 100644 --- a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/SecurityServletFilterTest.java +++ b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/SecurityServletFilterTest.java @@ -20,10 +20,10 @@ package org.sonar.server.platform.web; import java.io.IOException; -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 org.junit.Test; import static org.junit.Assert.assertNull; diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/StaticResourcesServletTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/StaticResourcesServletTest.java index 86faf15d2a7..492e8511677 100644 --- a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/StaticResourcesServletTest.java +++ b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/StaticResourcesServletTest.java @@ -23,7 +23,7 @@ import java.io.IOException; import java.io.InputStream; import javax.annotation.CheckForNull; import javax.annotation.Nullable; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/UserSessionFilterTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/UserSessionFilterTest.java index 1f0fb4cd404..555b17c9ccb 100644 --- a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/UserSessionFilterTest.java +++ b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/UserSessionFilterTest.java @@ -21,11 +21,11 @@ package org.sonar.server.platform.web; import java.io.IOException; import java.util.Optional; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.assertj.core.api.Assertions; import org.junit.Before; import org.junit.Test; @@ -33,8 +33,8 @@ import org.mockito.InOrder; import org.sonar.core.platform.ExtensionContainer; import org.sonar.db.DBSessions; import org.sonar.server.authentication.UserSessionInitializer; -import org.sonar.server.http.JavaxHttpRequest; -import org.sonar.server.http.JavaxHttpResponse; +import org.sonar.server.http.JakartaHttpRequest; +import org.sonar.server.http.JakartaHttpResponse; import org.sonar.server.platform.Platform; import org.sonar.server.setting.ThreadLocalSettings; @@ -76,7 +76,7 @@ public class UserSessionFilterTest { underTest.doFilter(request, response, chain); verify(chain).doFilter(request, response); - verify(userSessionInitializer).initUserSession(any(JavaxHttpRequest.class), any(JavaxHttpResponse.class)); + verify(userSessionInitializer).initUserSession(any(JakartaHttpRequest.class), any(JakartaHttpResponse.class)); } @Test @@ -86,7 +86,7 @@ public class UserSessionFilterTest { underTest.doFilter(request, response, chain); verify(chain, never()).doFilter(request, response); - verify(userSessionInitializer).initUserSession(any(JavaxHttpRequest.class), any(JavaxHttpResponse.class)); + verify(userSessionInitializer).initUserSession(any(JakartaHttpRequest.class), any(JakartaHttpResponse.class)); } @Test @@ -167,7 +167,7 @@ public class UserSessionFilterTest { private void mockUserSessionInitializer(boolean value) { when(container.getOptionalComponentByType(UserSessionInitializer.class)).thenReturn(Optional.of(userSessionInitializer)); - when(userSessionInitializer.initUserSession(any(JavaxHttpRequest.class), any(JavaxHttpResponse.class))).thenReturn(value); + when(userSessionInitializer.initUserSession(any(JakartaHttpRequest.class), any(JakartaHttpResponse.class))).thenReturn(value); } private RuntimeException mockUserSessionInitializerRemoveUserSessionFailing() { diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebPagesCacheTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebPagesCacheTest.java index 8911350c82d..3f725f3c803 100644 --- a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebPagesCacheTest.java +++ b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebPagesCacheTest.java @@ -20,7 +20,7 @@ package org.sonar.server.platform.web; import java.io.InputStream; -import javax.servlet.ServletContext; +import jakarta.servlet.ServletContext; import org.junit.Before; import org.junit.Test; import org.mockito.stubbing.Answer; diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebPagesFilterTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebPagesFilterTest.java index 88f9f0fe004..8b50dc48f03 100644 --- a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebPagesFilterTest.java +++ b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebPagesFilterTest.java @@ -19,12 +19,12 @@ */ package org.sonar.server.platform.web; -import javax.servlet.FilterChain; -import javax.servlet.ServletContext; -import javax.servlet.ServletOutputStream; -import javax.servlet.WriteListener; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletOutputStream; +import jakarta.servlet.WriteListener; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.junit.Before; import org.junit.Test; diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebServiceFilterTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebServiceFilterTest.java index 38e92a98e16..59abf6dbd0b 100644 --- a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebServiceFilterTest.java +++ b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebServiceFilterTest.java @@ -21,9 +21,9 @@ package org.sonar.server.platform.web; import java.util.ArrayList; import java.util.List; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletOutputStream; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.junit.Before; import org.junit.Test; import org.sonar.api.server.ws.Request; @@ -31,8 +31,8 @@ import org.sonar.api.server.ws.RequestHandler; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; import org.sonar.api.web.FilterChain; -import org.sonar.server.http.JavaxHttpRequest; -import org.sonar.server.http.JavaxHttpResponse; +import org.sonar.server.http.JakartaHttpRequest; +import org.sonar.server.http.JakartaHttpResponse; import org.sonar.server.ws.ServletFilterHandler; import org.sonar.server.ws.WebServiceEngine; @@ -103,7 +103,7 @@ public class WebServiceFilterTest { public void execute_ws() { underTest = new WebServiceFilter(webServiceEngine); - underTest.doFilter(new JavaxHttpRequest(request), new JavaxHttpResponse(response), chain); + underTest.doFilter(new JakartaHttpRequest(request), new JakartaHttpResponse(response), chain); verify(webServiceEngine).execute(any(), any()); } diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebServiceReroutingFilterTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebServiceReroutingFilterTest.java index b3495f40527..777750f8bdc 100644 --- a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebServiceReroutingFilterTest.java +++ b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebServiceReroutingFilterTest.java @@ -19,14 +19,14 @@ */ package org.sonar.server.platform.web; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.sonar.api.web.FilterChain; -import org.sonar.server.http.JavaxHttpRequest; -import org.sonar.server.http.JavaxHttpResponse; +import org.sonar.server.http.JakartaHttpRequest; +import org.sonar.server.http.JakartaHttpResponse; import org.sonar.server.ws.ServletRequest; import org.sonar.server.ws.ServletResponse; import org.sonar.server.ws.WebServiceEngine; @@ -65,7 +65,7 @@ public class WebServiceReroutingFilterTest { when(request.getServletPath()).thenReturn("/api/components/update_key"); when(request.getMethod()).thenReturn("POST"); - underTest.doFilter(new JavaxHttpRequest(request), new JavaxHttpResponse(response), chain); + underTest.doFilter(new JakartaHttpRequest(request), new JakartaHttpResponse(response), chain); assertRedirection("/api/projects/update_key", "POST"); } diff --git a/sonar-core/build.gradle b/sonar-core/build.gradle index 91f196e5a85..df6d5ddc907 100644 --- a/sonar-core/build.gradle +++ b/sonar-core/build.gradle @@ -9,7 +9,7 @@ dependencies { api 'commons-codec:commons-codec' api 'commons-io:commons-io' api 'org.apache.commons:commons-lang3' - api 'javax.annotation:javax.annotation-api' + api 'jakarta.annotation:jakarta.annotation-api' api 'javax.inject:javax.inject' api 'org.slf4j:slf4j-api' api 'org.sonarsource.api.plugin:sonar-plugin-api' diff --git a/sonar-duplications/src/test/files/java/RequestUtils.java b/sonar-duplications/src/test/files/java/RequestUtils.java index 2591a0d190a..5c32eb1e98c 100644 --- a/sonar-duplications/src/test/files/java/RequestUtils.java +++ b/sonar-duplications/src/test/files/java/RequestUtils.java @@ -34,10 +34,10 @@ import org.apache.struts.upload.FormFile; import org.apache.struts.upload.MultipartRequestHandler; import org.apache.struts.upload.MultipartRequestWrapper; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpSession; import java.lang.reflect.InvocationTargetException; import java.net.MalformedURLException; import java.net.URL; @@ -1133,7 +1133,7 @@ public class RequestUtils { * @since Struts 1.4 */ public static boolean isRequestForwarded(HttpServletRequest request) { - return (request.getAttribute("javax.servlet.forward.request_uri") != null); + return (request.getAttribute("jakarta.servlet.forward.request_uri") != null); } /** @@ -1144,7 +1144,7 @@ public class RequestUtils { * @since Struts 1.4 */ public static boolean isRequestIncluded(HttpServletRequest request) { - return (request.getAttribute("javax.servlet.include.request_uri") != null); + return (request.getAttribute("jakarta.servlet.include.request_uri") != null); } /** diff --git a/sonar-scanner-engine/build.gradle b/sonar-scanner-engine/build.gradle index f9252430adc..287d73e7181 100644 --- a/sonar-scanner-engine/build.gradle +++ b/sonar-scanner-engine/build.gradle @@ -33,7 +33,7 @@ dependencies { api 'com.fasterxml.staxmate:staxmate' implementation 'io.github.hakky54:sslcontext-kickstart' implementation 'org.bouncycastle:bcprov-jdk18on' - api 'javax.annotation:javax.annotation-api' + api 'jakarta.annotation:jakarta.annotation-api' api 'org.eclipse.jgit:org.eclipse.jgit' api 'org.tmatesoft.svnkit:svnkit' api 'org.slf4j:jcl-over-slf4j' diff --git a/sonar-testing-harness/build.gradle b/sonar-testing-harness/build.gradle index a46a55fb568..95eb17576ea 100644 --- a/sonar-testing-harness/build.gradle +++ b/sonar-testing-harness/build.gradle @@ -9,7 +9,7 @@ dependencies { api 'com.google.code.gson:gson' api 'com.googlecode.json-simple:json-simple' - api 'com.sun.mail:jakarta.mail' + api 'jakarta.mail:jakarta.mail-api' api 'commons-io:commons-io' api 'junit:junit' api 'org.assertj:assertj-core' diff --git a/sonar-testing-harness/src/main/java/org/sonar/test/html/MimeMessageAssert.java b/sonar-testing-harness/src/main/java/org/sonar/test/html/MimeMessageAssert.java index f8d2a3d4ace..e77db9363c2 100644 --- a/sonar-testing-harness/src/main/java/org/sonar/test/html/MimeMessageAssert.java +++ b/sonar-testing-harness/src/main/java/org/sonar/test/html/MimeMessageAssert.java @@ -19,10 +19,10 @@ */ package org.sonar.test.html; +import jakarta.mail.MessagingException; +import jakarta.mail.internet.MimeMessage; +import jakarta.mail.internet.MimeMultipart; import java.io.IOException; -import javax.mail.MessagingException; -import javax.mail.internet.MimeMessage; -import javax.mail.internet.MimeMultipart; import org.assertj.core.api.AbstractAssert; import org.assertj.core.api.Assertions; diff --git a/sonar-testing-harness/src/main/java/org/sonar/test/html/MultipartMessageAssert.java b/sonar-testing-harness/src/main/java/org/sonar/test/html/MultipartMessageAssert.java index 20c6cf22583..c96f23e61fe 100644 --- a/sonar-testing-harness/src/main/java/org/sonar/test/html/MultipartMessageAssert.java +++ b/sonar-testing-harness/src/main/java/org/sonar/test/html/MultipartMessageAssert.java @@ -19,13 +19,13 @@ */ package org.sonar.test.html; +import jakarta.mail.BodyPart; +import jakarta.mail.MessagingException; +import jakarta.mail.Multipart; +import jakarta.mail.internet.MimeMultipart; import java.io.IOException; import java.util.Iterator; import java.util.NoSuchElementException; -import javax.mail.BodyPart; -import javax.mail.MessagingException; -import javax.mail.Multipart; -import javax.mail.internet.MimeMultipart; import org.assertj.core.api.AbstractAssert; import org.assertj.core.api.Assertions; diff --git a/sonar-ws/build.gradle b/sonar-ws/build.gradle index 5549917b93c..1b178f58faa 100644 --- a/sonar-ws/build.gradle +++ b/sonar-ws/build.gradle @@ -19,7 +19,7 @@ dependencies { api 'org.sonarsource.api.plugin:sonar-plugin-api' compileOnlyApi 'com.github.spotbugs:spotbugs-annotations' - compileOnlyApi 'javax.annotation:javax.annotation-api' + compileOnlyApi 'jakarta.annotation:jakarta.annotation-api' testImplementation 'com.squareup.okhttp3:mockwebserver' testImplementation 'com.tngtech.java:junit-dataprovider' |