From ab304a096e9f361b8b920540bbcd805d7443be2b Mon Sep 17 00:00:00 2001 From: lachan-roberts Date: Wed, 6 Mar 2019 17:11:57 +1100 Subject: [PATCH] avoid adding NULL UpgradeListeners to WebSocketClient Signed-off-by: lachan-roberts --- .../org/eclipse/jetty/websocket/client/WebSocketClient.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jetty-websocket/jetty-websocket-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketClient.java b/jetty-websocket/jetty-websocket-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketClient.java index 78f5e77d98d..00ecfb1fede 100644 --- a/jetty-websocket/jetty-websocket-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketClient.java +++ b/jetty-websocket/jetty-websocket-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketClient.java @@ -135,7 +135,8 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketPoli public CompletableFuture connect(Object websocket, URI toUri, UpgradeRequest request, UpgradeListener listener) throws IOException { JettyClientUpgradeRequest upgradeRequest = new JettyClientUpgradeRequest(this, coreClient, request, toUri, websocket); - upgradeRequest.addListener(listener); + if (listener != null) + upgradeRequest.addListener(listener); coreClient.connect(upgradeRequest); return upgradeRequest.getFutureSession(); }