diff options
Diffstat (limited to 'server/sonar-webserver')
35 files changed, 176 insertions, 175 deletions
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"); } |