Author: violetagg
Date: Wed Sep 17 06:36:35 2014
New Revision: 1625471

URL: http://svn.apache.org/r1625471
Log:
Merged revision 1606653 from tomcat/trunk:
Fix root cause of NPE when using WebSocket clients.

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsFrameClient.java
    
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1606653

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsFrameClient.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsFrameClient.java?rev=1625471&r1=1625470&r2=1625471&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsFrameClient.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsFrameClient.java 
Wed Sep 17 06:36:35 2014
@@ -37,7 +37,10 @@ public class WsFrameClient extends WsFra
         this.response = response;
         this.channel = channel;
         this.handler = new WsFrameClientCompletionHandler();
+    }
+
 
+    void startInputProcessing() {
         try {
             processSocketRead();
         } catch (IOException e) {

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java?rev=1625471&r1=1625470&r2=1625471&view=diff
==============================================================================
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java 
(original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java 
Wed Sep 17 06:36:35 2014
@@ -344,8 +344,6 @@ public class WsWebSocketContainer
             }
         }
 
-        // TODO Add extension/transformation support to the client
-
         // Switch to WebSocket
         WsRemoteEndpointImplClient wsRemoteEndpointClient = new 
WsRemoteEndpointImplClient(channel);
 
@@ -353,13 +351,17 @@ public class WsWebSocketContainer
                 this, null, null, null, null, null, subProtocol,
                 Collections.<String, String> emptyMap(), secure,
                 clientEndpointConfiguration);
-        endpoint.onOpen(wsSession, clientEndpointConfiguration);
-        registerSession(endpoint, wsSession);
 
-        // Object creation will trigger input processing
-        @SuppressWarnings("unused")
         WsFrameClient wsFrameClient = new WsFrameClient(response, channel,
                 wsSession);
+        // WsFrame adds the necessary final transformations. Copy the
+        // completed transformation chain to the remote end point.
+        
wsRemoteEndpointClient.setTransformation(wsFrameClient.getTransformation());
+
+        endpoint.onOpen(wsSession, clientEndpointConfiguration);
+        registerSession(endpoint, wsSession);
+
+        wsFrameClient.startInputProcessing();
 
         return wsSession;
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to