From ac38f061477f8f77d1f1ae6d555f3e0e58b72094 Mon Sep 17 00:00:00 2001 From: Manfred Riem Date: Mon, 25 Nov 2024 16:54:01 -0600 Subject: [PATCH] Fixes #4270 - Cleanup various bits (#4272) --- .../tck/piranha/PiranhaDeploymentExceptionTransformer.java | 1 + feature/isolatedwebapp/src/main/java/module-info.java | 2 +- .../java/cloud/piranha/feature/webapps/WebAppsFeature.java | 5 +++++ http/crac/src/main/java/module-info.java | 4 ++-- .../cloud/piranha/http/netty/NettyHttpServerHandler.java | 1 + http/virtual/src/main/java/module-info.java | 2 +- .../piranha/http/webapp/HttpWebApplicationOutputStream.java | 1 + .../piranha/http/webapp/HttpWebApplicationResponse.java | 2 +- .../src/main/java/cloud/piranha/maven/plugin/BaseMojo.java | 1 + test/micro/snoop/src/test/java/snoop/SnoopIT.java | 5 ----- 10 files changed, 14 insertions(+), 10 deletions(-) diff --git a/external/webprofile-tck/cdi/runner/core/src/test/java/org/jboss/weld/tck/piranha/PiranhaDeploymentExceptionTransformer.java b/external/webprofile-tck/cdi/runner/core/src/test/java/org/jboss/weld/tck/piranha/PiranhaDeploymentExceptionTransformer.java index dbb57e654c..ac6c4060be 100644 --- a/external/webprofile-tck/cdi/runner/core/src/test/java/org/jboss/weld/tck/piranha/PiranhaDeploymentExceptionTransformer.java +++ b/external/webprofile-tck/cdi/runner/core/src/test/java/org/jboss/weld/tck/piranha/PiranhaDeploymentExceptionTransformer.java @@ -60,6 +60,7 @@ public class PiranhaDeploymentExceptionTransformer implements DeploymentExceptio @Override public Throwable transform(Throwable throwable) { + @SuppressWarnings("unchecked") List throwableList = ExceptionUtils.getThrowableList(throwable); if (throwableList.size() < 1) return throwable; diff --git a/feature/isolatedwebapp/src/main/java/module-info.java b/feature/isolatedwebapp/src/main/java/module-info.java index fa12e0d77d..320bcbaf44 100644 --- a/feature/isolatedwebapp/src/main/java/module-info.java +++ b/feature/isolatedwebapp/src/main/java/module-info.java @@ -36,7 +36,7 @@ exports cloud.piranha.feature.isolatedwebapp; opens cloud.piranha.feature.isolatedwebapp; requires cloud.piranha.feature.impl; - requires cloud.piranha.http.webapp; + requires transitive cloud.piranha.http.webapp; requires cloud.piranha.micro.builder; requires cloud.piranha.micro.loader; requires shrinkwrap.api; diff --git a/feature/webapps/src/main/java/cloud/piranha/feature/webapps/WebAppsFeature.java b/feature/webapps/src/main/java/cloud/piranha/feature/webapps/WebAppsFeature.java index 3c1d4f8d79..1e179d69a3 100644 --- a/feature/webapps/src/main/java/cloud/piranha/feature/webapps/WebAppsFeature.java +++ b/feature/webapps/src/main/java/cloud/piranha/feature/webapps/WebAppsFeature.java @@ -34,6 +34,7 @@ import cloud.piranha.http.api.HttpServerProcessor; import cloud.piranha.http.webapp.HttpWebApplicationServer; import java.io.File; +import java.lang.System.Logger.Level; import java.util.ArrayList; /** @@ -107,6 +108,10 @@ public HttpWebApplicationServer getHttpWebApplicationServer() { @Override public void init() { + if (LOGGER.isLoggable(Level.DEBUG)) { + LOGGER.log(Level.DEBUG, "Initializing WebAppsFeature"); + } + if (webApplicationServer == null) { webApplicationServer = new HttpWebApplicationServer(); } diff --git a/http/crac/src/main/java/module-info.java b/http/crac/src/main/java/module-info.java index 3f0cba0a04..289bb69389 100644 --- a/http/crac/src/main/java/module-info.java +++ b/http/crac/src/main/java/module-info.java @@ -41,6 +41,6 @@ exports cloud.piranha.http.crac; opens cloud.piranha.http.crac; - requires cloud.piranha.http.api; - requires org.crac; + requires transitive cloud.piranha.http.api; + requires transitive org.crac; } diff --git a/http/netty/src/main/java/cloud/piranha/http/netty/NettyHttpServerHandler.java b/http/netty/src/main/java/cloud/piranha/http/netty/NettyHttpServerHandler.java index 308abadb27..33a60b4f75 100644 --- a/http/netty/src/main/java/cloud/piranha/http/netty/NettyHttpServerHandler.java +++ b/http/netty/src/main/java/cloud/piranha/http/netty/NettyHttpServerHandler.java @@ -94,6 +94,7 @@ public void channelReadComplete(ChannelHandlerContext context) { @Override protected void channelRead0(ChannelHandlerContext context, FullHttpRequest object) { NettyHttpServerRequest nettyRequest = new NettyHttpServerRequest(context, object, secure); + @SuppressWarnings("deprecation") FullHttpResponse response = new DefaultFullHttpResponse(HTTP_1_1, OK, true); NettyHttpServerResponse nettyResponse = new NettyHttpServerResponse(response); httpServerProcessor.process(nettyRequest, nettyResponse); diff --git a/http/virtual/src/main/java/module-info.java b/http/virtual/src/main/java/module-info.java index afe5c91a8b..43a1eb4acf 100644 --- a/http/virtual/src/main/java/module-info.java +++ b/http/virtual/src/main/java/module-info.java @@ -36,6 +36,6 @@ exports cloud.piranha.http.virtual; opens cloud.piranha.http.virtual; - requires cloud.piranha.http.api; + requires transitive cloud.piranha.http.api; requires cloud.piranha.http.impl; } diff --git a/http/webapp/src/main/java/cloud/piranha/http/webapp/HttpWebApplicationOutputStream.java b/http/webapp/src/main/java/cloud/piranha/http/webapp/HttpWebApplicationOutputStream.java index 3a34d90298..d536246e69 100644 --- a/http/webapp/src/main/java/cloud/piranha/http/webapp/HttpWebApplicationOutputStream.java +++ b/http/webapp/src/main/java/cloud/piranha/http/webapp/HttpWebApplicationOutputStream.java @@ -96,6 +96,7 @@ public void writeStatusLine() throws IOException { httpServerResponse.writeStatusLine(); } + @SuppressWarnings("removal") @Override public void writeHeaders() throws IOException { diff --git a/http/webapp/src/main/java/cloud/piranha/http/webapp/HttpWebApplicationResponse.java b/http/webapp/src/main/java/cloud/piranha/http/webapp/HttpWebApplicationResponse.java index 64c11eae15..d05edf039e 100644 --- a/http/webapp/src/main/java/cloud/piranha/http/webapp/HttpWebApplicationResponse.java +++ b/http/webapp/src/main/java/cloud/piranha/http/webapp/HttpWebApplicationResponse.java @@ -47,7 +47,7 @@ public class HttpWebApplicationResponse extends DefaultWebApplicationResponse { /** * Stores the wrapped HttpServerResponse. */ - private final HttpServerResponse wrapped; + protected final HttpServerResponse wrapped; /** * Constructor. diff --git a/maven/plugin/src/main/java/cloud/piranha/maven/plugin/BaseMojo.java b/maven/plugin/src/main/java/cloud/piranha/maven/plugin/BaseMojo.java index 404fa9f2ec..64bd4e7d56 100644 --- a/maven/plugin/src/main/java/cloud/piranha/maven/plugin/BaseMojo.java +++ b/maven/plugin/src/main/java/cloud/piranha/maven/plugin/BaseMojo.java @@ -186,6 +186,7 @@ protected String createArtifactPath( * @return the URL. * @throws IOException when an I/O error occurs. */ + @SuppressWarnings("deprecation") protected URL createMavenCentralArtifactUrl(String groupId, String artifactId, String version, String type) throws IOException { return new URL("https://repo1.maven.org/maven2/" diff --git a/test/micro/snoop/src/test/java/snoop/SnoopIT.java b/test/micro/snoop/src/test/java/snoop/SnoopIT.java index 3b62050064..77a144fa38 100644 --- a/test/micro/snoop/src/test/java/snoop/SnoopIT.java +++ b/test/micro/snoop/src/test/java/snoop/SnoopIT.java @@ -44,11 +44,6 @@ */ public class SnoopIT { - /** - * Stores the process. - */ - static private Process process; - /** * Stores the port */