From 902ca0004c1c0b1e641c337f8937a2ab4f20f27a Mon Sep 17 00:00:00 2001 From: Ronald Brill Date: Sat, 10 Feb 2024 18:53:00 +0100 Subject: [PATCH] New subproject htmlunit-websocket-client. For the start this is a shaded version of the lastes Jetty 9 websocket-client (issue #704) --- pom.xml | 17 +++++++++-------- src/changes/changes.xml | 7 +++++++ .../websocket/JettyWebSocketAdapter.java | 10 +++++----- .../org/htmlunit/archunit/ArchitectureTest.java | 12 ++++++++++++ 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index 69937cdf941..1fbb4a8ed27 100644 --- a/pom.xml +++ b/pom.xml @@ -30,11 +30,13 @@ 3.11.2 3.11.0 3.11.0 + 3.12.0-SNAPSHOT + + 4.5.14 4.17.0 4.17.0 - 4.5.14 9.4.53.v20231009 2.22.1 @@ -1164,6 +1166,12 @@ htmlunit-csp ${htmlunitcsp.version} + + org.htmlunit + htmlunit-websocket-client + ${htmlunitwebsocketclient.version} + + org.apache.commons commons-lang3 @@ -1206,13 +1214,6 @@ 0.1.2 - - - org.eclipse.jetty.websocket - websocket-client - ${jetty.version} - - junit diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 4f3b6ce80c5..16e05ccc56b 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -7,6 +7,13 @@ + + + New subproject htmlunit-websocket-client. For the start this is a shaded version of the lastes + Jetty 9 websocket-client. + + + Fix NPE when defining a javascript constructor alias for a non existing constructor. diff --git a/src/main/java/org/htmlunit/websocket/JettyWebSocketAdapter.java b/src/main/java/org/htmlunit/websocket/JettyWebSocketAdapter.java index 8a56563f76e..2c3b9948ea0 100644 --- a/src/main/java/org/htmlunit/websocket/JettyWebSocketAdapter.java +++ b/src/main/java/org/htmlunit/websocket/JettyWebSocketAdapter.java @@ -19,10 +19,10 @@ import java.nio.ByteBuffer; import java.util.concurrent.Future; -import org.eclipse.jetty.util.ssl.SslContextFactory; -import org.eclipse.jetty.websocket.api.Session; -import org.eclipse.jetty.websocket.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.client.WebSocketClient; +import org.htmlunit.jetty.util.ssl.SslContextFactory; +import org.htmlunit.jetty.websocket.api.Session; +import org.htmlunit.jetty.websocket.api.WebSocketPolicy; +import org.htmlunit.jetty.websocket.client.WebSocketClient; import org.htmlunit.WebClient; import org.htmlunit.WebClientOptions; import org.htmlunit.corejs.javascript.typedarrays.NativeArrayBuffer; @@ -142,7 +142,7 @@ public void closeClient() throws Exception { } } - private class JettyWebSocketAdapterImpl extends org.eclipse.jetty.websocket.api.WebSocketAdapter { + private class JettyWebSocketAdapterImpl extends org.htmlunit.jetty.websocket.api.WebSocketAdapter { JettyWebSocketAdapterImpl() { } diff --git a/src/test/java/org/htmlunit/archunit/ArchitectureTest.java b/src/test/java/org/htmlunit/archunit/ArchitectureTest.java index c90cd89e05b..0c96bbbb6ae 100644 --- a/src/test/java/org/htmlunit/archunit/ArchitectureTest.java +++ b/src/test/java/org/htmlunit/archunit/ArchitectureTest.java @@ -68,6 +68,8 @@ public class ArchitectureTest { .and().doNotHaveFullyQualifiedName("org.htmlunit.csp.Utils") + .and().resideOutsideOfPackage("org.htmlunit.jetty..") + .should().resideInAPackage("org.htmlunit.util"); /** @@ -79,6 +81,7 @@ public class ArchitectureTest { .doNotHaveFullyQualifiedName("org.htmlunit.html.applets.AppletContextImpl") .and().resideOutsideOfPackage("org.htmlunit.platform..") .and().resideOutsideOfPackage("org.htmlunit.corejs.javascript.tools..") + .and().resideOutsideOfPackage("org.htmlunit.jetty..") .should().dependOnClassesThat().resideInAnyPackage("java.awt.."); /** @@ -308,6 +311,8 @@ public void check(final JavaMethod method, final ConditionEvents events) { .that() .doNotHaveFullyQualifiedName("org.htmlunit.platform.image.ImageIOImageData") .and().doNotHaveFullyQualifiedName("org.htmlunit.platform.canvas.rendering.AwtRenderingBackend") + .and().doNotHaveFullyQualifiedName("org.htmlunit.platform.canvas.rendering.AwtRenderingBackend") + .and().resideOutsideOfPackage("org.htmlunit.jetty..") .should().dependOnClassesThat().resideInAnyPackage("javax.imageio.."); /** @@ -367,4 +372,11 @@ public void check(final JavaMethod method, final ConditionEvents events) { .and().resideOutsideOfPackage("org.htmlunit.corejs..") .should().dependOnClassesThat().resideInAnyPackage("org.htmlunit.corejs.."); + + /** + * Do not use jetty. + */ + @ArchTest + public static final ArchRule jettyPackageRule = noClasses() + .should().dependOnClassesThat().resideInAnyPackage("org.eclipse.jetty.."); }