From 5a31047b243d82a25d10ef771bda54e8a33af7a6 Mon Sep 17 00:00:00 2001 From: Manfred Riem Date: Fri, 22 Nov 2024 16:41:56 -0600 Subject: [PATCH] Fixes #4240 - Cleanup various bits --- .../cloud/piranha/micro/core/PiranhaBeanArchiveHandler.java | 1 + micro/core/src/main/java/module-info.java | 4 ++-- multi/src/main/java/cloud/piranha/multi/MultiPiranha.java | 1 + multi/src/main/java/module-info.java | 2 ++ .../java/cloud/piranha/resource/impl/ByteArrayResource.java | 2 ++ .../java/cloud/piranha/resource/impl/DirectoryResource.java | 1 + .../main/java/cloud/piranha/resource/impl/JarResource.java | 1 + .../java/cloud/piranha/resource/impl/PrefixJarResource.java | 1 + .../cloud/piranha/resource/shrinkwrap/ShrinkWrapResource.java | 2 ++ single/src/main/java/cloud/piranha/single/SinglePiranha.java | 1 + .../java/cloud/piranha/single/SinglePiranhaBuilderTest.java | 2 -- .../src/test/java/cloud/piranha/single/SinglePiranhaTest.java | 1 - .../src/main/java/module-info.java | 4 ++-- test/embedded/soteria-form/src/test/java/form/FormTest.java | 1 + test/micro/snoop/src/main/java/snoop/SnoopServlet.java | 1 - .../helloworld/src/test/java/helloworld/HelloWorldIT.java | 1 - 16 files changed, 17 insertions(+), 9 deletions(-) diff --git a/micro/core/src/main/java/cloud/piranha/micro/core/PiranhaBeanArchiveHandler.java b/micro/core/src/main/java/cloud/piranha/micro/core/PiranhaBeanArchiveHandler.java index a118585b48..338ee00e65 100644 --- a/micro/core/src/main/java/cloud/piranha/micro/core/PiranhaBeanArchiveHandler.java +++ b/micro/core/src/main/java/cloud/piranha/micro/core/PiranhaBeanArchiveHandler.java @@ -61,6 +61,7 @@ public BeanArchiveBuilder handle(String beanArchiveReference) { indexURL = "shrinkwrap://cloud.piranha.modular.classes/META-INF/jandex.idx"; } else { try { + @SuppressWarnings("deprecation") URL url = new URL(beanArchiveReference); String protocol = url.getProtocol(); if (!protocol.equals("shrinkwrap")) { diff --git a/micro/core/src/main/java/module-info.java b/micro/core/src/main/java/module-info.java index 40be65e1f0..113735e0a7 100644 --- a/micro/core/src/main/java/module-info.java +++ b/micro/core/src/main/java/module-info.java @@ -53,8 +53,8 @@ requires cloud.piranha.http.webapp; requires cloud.piranha.resource.shrinkwrap; requires jakarta.annotation; - requires jakarta.cdi; - requires jakarta.security; + requires transitive jakarta.cdi; + requires transitive jakarta.security; requires java.logging; requires java.naming; requires java.xml; diff --git a/multi/src/main/java/cloud/piranha/multi/MultiPiranha.java b/multi/src/main/java/cloud/piranha/multi/MultiPiranha.java index e9f9a9d421..c56e294bf8 100644 --- a/multi/src/main/java/cloud/piranha/multi/MultiPiranha.java +++ b/multi/src/main/java/cloud/piranha/multi/MultiPiranha.java @@ -165,6 +165,7 @@ private boolean isStarted() { /** * Run method. */ + @SuppressWarnings("unchecked") @Override public void run() { long startTime = System.currentTimeMillis(); diff --git a/multi/src/main/java/module-info.java b/multi/src/main/java/module-info.java index b3fb0ea88f..9dd5a024a0 100644 --- a/multi/src/main/java/module-info.java +++ b/multi/src/main/java/module-info.java @@ -42,4 +42,6 @@ requires cloud.piranha.feature.webapps; requires java.logging; requires java.naming; + requires transitive cloud.piranha.core.api; + requires transitive jakarta.servlet; } diff --git a/resource/impl/src/main/java/cloud/piranha/resource/impl/ByteArrayResource.java b/resource/impl/src/main/java/cloud/piranha/resource/impl/ByteArrayResource.java index d1b8196e3b..1bd27232fb 100644 --- a/resource/impl/src/main/java/cloud/piranha/resource/impl/ByteArrayResource.java +++ b/resource/impl/src/main/java/cloud/piranha/resource/impl/ByteArrayResource.java @@ -91,6 +91,7 @@ public byte[] getBytes() { * @param url the url in string form. * @return the URL, or null if not found. */ + @SuppressWarnings("deprecation") @Override public URL getResource(String url) { String location = getLocationFromUrl(url); @@ -150,6 +151,7 @@ private String getLocationFromUrl(String url) { // Relative URL: [bytes://][root][location] eg bytes://root/WEB-INF/web.xml try { + @SuppressWarnings("deprecation") URL bytesURL = new URL(url.substring(url.indexOf(BYTES_PROTOCOL))); String hostName = bytesURL.getHost(); diff --git a/resource/impl/src/main/java/cloud/piranha/resource/impl/DirectoryResource.java b/resource/impl/src/main/java/cloud/piranha/resource/impl/DirectoryResource.java index 48b6a898a4..e082201628 100644 --- a/resource/impl/src/main/java/cloud/piranha/resource/impl/DirectoryResource.java +++ b/resource/impl/src/main/java/cloud/piranha/resource/impl/DirectoryResource.java @@ -106,6 +106,7 @@ public String getName() { /** * {@return the resource} */ + @SuppressWarnings("deprecation") @Override public URL getResource(String location) { URL result = null; diff --git a/resource/impl/src/main/java/cloud/piranha/resource/impl/JarResource.java b/resource/impl/src/main/java/cloud/piranha/resource/impl/JarResource.java index 2e3c06c265..6a59bc2cc8 100644 --- a/resource/impl/src/main/java/cloud/piranha/resource/impl/JarResource.java +++ b/resource/impl/src/main/java/cloud/piranha/resource/impl/JarResource.java @@ -77,6 +77,7 @@ public JarResource(File jarFile) { /** * {@return the resource} */ + @SuppressWarnings("deprecation") @Override public URL getResource(String location) { URL result = null; diff --git a/resource/impl/src/main/java/cloud/piranha/resource/impl/PrefixJarResource.java b/resource/impl/src/main/java/cloud/piranha/resource/impl/PrefixJarResource.java index e02bc485ad..505a3b5771 100644 --- a/resource/impl/src/main/java/cloud/piranha/resource/impl/PrefixJarResource.java +++ b/resource/impl/src/main/java/cloud/piranha/resource/impl/PrefixJarResource.java @@ -83,6 +83,7 @@ public PrefixJarResource(JarFile jarFile, String prefix) { } } + @SuppressWarnings("deprecation") @Override public URL getResource(String location) { URL result = null; diff --git a/resource/shrinkwrap/src/main/java/cloud/piranha/resource/shrinkwrap/ShrinkWrapResource.java b/resource/shrinkwrap/src/main/java/cloud/piranha/resource/shrinkwrap/ShrinkWrapResource.java index 90942214fe..33ea8361c9 100644 --- a/resource/shrinkwrap/src/main/java/cloud/piranha/resource/shrinkwrap/ShrinkWrapResource.java +++ b/resource/shrinkwrap/src/main/java/cloud/piranha/resource/shrinkwrap/ShrinkWrapResource.java @@ -108,6 +108,7 @@ public ShrinkWrapResource(Archive archive) { archiveStreamHandler = new ArchiveURLStreamHandler(this.archive); } + @SuppressWarnings("deprecation") @Override public URL getResource(String url) { String location = getLocationFromUrl(url); @@ -221,6 +222,7 @@ private String getLocationFromUrl(String url) { // Relative URL: [shrinkwrap://][jar name][location] try { + @SuppressWarnings("deprecation") URL archiveURL = new URL(url.substring(url.indexOf(SHRINKWRAP_PROTOCOL))); String archiveName = archiveURL.getHost(); diff --git a/single/src/main/java/cloud/piranha/single/SinglePiranha.java b/single/src/main/java/cloud/piranha/single/SinglePiranha.java index 8c22af5e0e..ce6d9d5c5b 100644 --- a/single/src/main/java/cloud/piranha/single/SinglePiranha.java +++ b/single/src/main/java/cloud/piranha/single/SinglePiranha.java @@ -116,6 +116,7 @@ public PiranhaConfiguration getConfiguration() { /** * Run method. */ + @SuppressWarnings("unchecked") @Override public void run() { long startTime = System.currentTimeMillis(); diff --git a/single/src/test/java/cloud/piranha/single/SinglePiranhaBuilderTest.java b/single/src/test/java/cloud/piranha/single/SinglePiranhaBuilderTest.java index 222ca0f32b..48b4641367 100644 --- a/single/src/test/java/cloud/piranha/single/SinglePiranhaBuilderTest.java +++ b/single/src/test/java/cloud/piranha/single/SinglePiranhaBuilderTest.java @@ -27,8 +27,6 @@ */ package cloud.piranha.single; -import cloud.piranha.single.SinglePiranha; -import cloud.piranha.single.SinglePiranhaBuilder; import java.net.ConnectException; import java.net.Socket; import static org.junit.jupiter.api.Assertions.assertNotNull; diff --git a/single/src/test/java/cloud/piranha/single/SinglePiranhaTest.java b/single/src/test/java/cloud/piranha/single/SinglePiranhaTest.java index 7476165f5d..42d89d3c91 100644 --- a/single/src/test/java/cloud/piranha/single/SinglePiranhaTest.java +++ b/single/src/test/java/cloud/piranha/single/SinglePiranhaTest.java @@ -27,7 +27,6 @@ */ package cloud.piranha.single; -import cloud.piranha.single.SinglePiranha; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertNotNull; diff --git a/spring/spring-boot-starter-piranha-embedded/src/main/java/module-info.java b/spring/spring-boot-starter-piranha-embedded/src/main/java/module-info.java index b55cdf82a2..cb725b68e9 100644 --- a/spring/spring-boot-starter-piranha-embedded/src/main/java/module-info.java +++ b/spring/spring-boot-starter-piranha-embedded/src/main/java/module-info.java @@ -36,8 +36,8 @@ exports cloud.piranha.spring.starter.embedded; opens cloud.piranha.spring.starter.embedded; requires cloud.piranha.embedded; - requires cloud.piranha.http.api; requires cloud.piranha.http.impl; requires cloud.piranha.http.webapp; - requires spring.boot; + requires transitive cloud.piranha.http.api; + requires transitive spring.boot; } diff --git a/test/embedded/soteria-form/src/test/java/form/FormTest.java b/test/embedded/soteria-form/src/test/java/form/FormTest.java index 137e805c23..66e8b631e6 100644 --- a/test/embedded/soteria-form/src/test/java/form/FormTest.java +++ b/test/embedded/soteria-form/src/test/java/form/FormTest.java @@ -110,6 +110,7 @@ void testAuthenticated() throws Exception { assertEquals(302, response.getStatus(), "Should redirect"); + @SuppressWarnings("deprecation") URL redirectUrl = new URL(response.getHeader("Location")); request = new EmbeddedRequestBuilder() .servletPath(redirectUrl.getPath()) diff --git a/test/micro/snoop/src/main/java/snoop/SnoopServlet.java b/test/micro/snoop/src/main/java/snoop/SnoopServlet.java index a2e70bb7e2..243a2b61cf 100644 --- a/test/micro/snoop/src/main/java/snoop/SnoopServlet.java +++ b/test/micro/snoop/src/main/java/snoop/SnoopServlet.java @@ -77,7 +77,6 @@ public class SnoopServlet extends HttpServlet { * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ - @SuppressWarnings({"deprecation"}) protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); diff --git a/test/webprofile/helloworld/src/test/java/helloworld/HelloWorldIT.java b/test/webprofile/helloworld/src/test/java/helloworld/HelloWorldIT.java index 88e2a6136c..fc602626be 100644 --- a/test/webprofile/helloworld/src/test/java/helloworld/HelloWorldIT.java +++ b/test/webprofile/helloworld/src/test/java/helloworld/HelloWorldIT.java @@ -33,7 +33,6 @@ import java.net.http.HttpResponse; import java.net.http.HttpResponse.BodyHandlers; import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; /**