From a79b154d1b77a49822b4507e450c612876d8861b Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Mon, 29 Dec 2014 12:10:55 -0700 Subject: [PATCH] 456209 - Bad ContextClassLoader in WebSocket onMessage + Sets the class loader on an incoming frame to the class loader that loaded the web socket session Also-by: Michael MacFadden Signed-off-by: Joakim Erdfelt --- .../jetty/websocket/common/WebSocketSession.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java index 70a32f9855a..ae61de6e86e 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java @@ -303,10 +303,19 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Inc @Override public void incomingFrame(Frame frame) { - if (connection.getIOState().isInputAvailable()) + ClassLoader old = Thread.currentThread().getContextClassLoader(); + try { - // Forward Frames Through Extension List - incomingHandler.incomingFrame(frame); + Thread.currentThread().setContextClassLoader(classLoader); + if (connection.getIOState().isInputAvailable()) + { + // Forward Frames Through Extension List + incomingHandler.incomingFrame(frame); + } + } + finally + { + Thread.currentThread().setContextClassLoader(old); } }