From 464c46a757f787a3287bd8499dc1d154cec2887b Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Tue, 15 Mar 2016 09:20:34 -0700 Subject: [PATCH 1/2] Issue #427 - Squelch intentional exceptions seen during websocket testing --- .../misbehaving/ListenerRuntimeOnConnectSocket.java | 7 +------ .../server/misbehaving/MisbehavingClassTest.java | 13 +++++++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/misbehaving/ListenerRuntimeOnConnectSocket.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/misbehaving/ListenerRuntimeOnConnectSocket.java index eefb6cafdb9..9c43fae6b11 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/misbehaving/ListenerRuntimeOnConnectSocket.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/misbehaving/ListenerRuntimeOnConnectSocket.java @@ -36,12 +36,7 @@ public class ListenerRuntimeOnConnectSocket extends WebSocketAdapter { super.onWebSocketConnect(sess); - // Intentional runtime exception. - int[] arr = new int[5]; - for (int i = 0; i < 10; i++) - { - arr[i] = 222; - } + throw new ArrayIndexOutOfBoundsException("Intentional Exception"); } @Override diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/misbehaving/MisbehavingClassTest.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/misbehaving/MisbehavingClassTest.java index 326a38af9e1..189c679ba13 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/misbehaving/MisbehavingClassTest.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/misbehaving/MisbehavingClassTest.java @@ -18,9 +18,6 @@ package org.eclipse.jetty.websocket.server.misbehaving; -import static org.hamcrest.Matchers.*; -import static org.junit.Assert.*; - import java.util.concurrent.TimeUnit; import org.eclipse.jetty.toolchain.test.EventQueue; @@ -29,7 +26,7 @@ import org.eclipse.jetty.websocket.api.StatusCode; import org.eclipse.jetty.websocket.common.CloseInfo; import org.eclipse.jetty.websocket.common.OpCode; import org.eclipse.jetty.websocket.common.WebSocketFrame; -import org.eclipse.jetty.websocket.common.events.AbstractEventDriver; +import org.eclipse.jetty.websocket.common.WebSocketSession; import org.eclipse.jetty.websocket.common.test.BlockheadClient; import org.eclipse.jetty.websocket.common.test.IBlockheadClient; import org.eclipse.jetty.websocket.server.SimpleServletServer; @@ -37,6 +34,10 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; +import static org.hamcrest.Matchers.instanceOf; +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThat; + /** * Testing badly behaving Socket class implementations to get the best * error messages and state out of the websocket implementation. @@ -67,7 +68,7 @@ public class MisbehavingClassTest { client.setProtocols("listener-runtime-connect"); client.setTimeout(1,TimeUnit.SECONDS); - try (StacklessLogging scope = new StacklessLogging(AbstractEventDriver.class)) + try (StacklessLogging scope = new StacklessLogging(ListenerRuntimeOnConnectSocket.class, WebSocketSession.class)) { ListenerRuntimeOnConnectSocket socket = badSocketsServlet.listenerRuntimeConnect; socket.reset(); @@ -103,7 +104,7 @@ public class MisbehavingClassTest { client.setProtocols("annotated-runtime-connect"); client.setTimeout(1,TimeUnit.SECONDS); - try (StacklessLogging scope = new StacklessLogging(AbstractEventDriver.class)) + try (StacklessLogging scope = new StacklessLogging(AnnotatedRuntimeOnConnectSocket.class, WebSocketSession.class)) { AnnotatedRuntimeOnConnectSocket socket = badSocketsServlet.annotatedRuntimeConnect; socket.reset(); From f8626ecb3dd5910c7d32dadb04df2b38e9d2d89d Mon Sep 17 00:00:00 2001 From: Raman Gupta Date: Thu, 10 Mar 2016 10:40:05 -0500 Subject: [PATCH 2/2] Issue #418 - Add osgi capability for endpoint configurator Signed-off-by: Raman Gupta --- jetty-websocket/javax-websocket-server-impl/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetty-websocket/javax-websocket-server-impl/pom.xml b/jetty-websocket/javax-websocket-server-impl/pom.xml index d515139a7cb..e6ff74707d5 100644 --- a/jetty-websocket/javax-websocket-server-impl/pom.xml +++ b/jetty-websocket/javax-websocket-server-impl/pom.xml @@ -64,7 +64,7 @@ javax.websocket.server Implementation org.eclipse.jetty.websocket.jsr356.server.*;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}" osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)";resolution:=optional - osgi.serviceloader; osgi.serviceloader=javax.servlet.ServletContainerInitializer + osgi.serviceloader; osgi.serviceloader=javax.servlet.ServletContainerInitializer, osgi.serviceloader; osgi.serviceloader=javax.websocket.server.ServerEndpointConfig$Configurator