You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2012/03/04 15:23:41 UTC

svn commit: r1296813 - /tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java

Author: markt
Date: Sun Mar  4 14:23:41 2012
New Revision: 1296813

URL: http://svn.apache.org/viewvc?rev=1296813&view=rev
Log:
Ensure we try and send a close message on an IOE as well as triggering
onClose()

Modified:
    tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java

Modified: tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java?rev=1296813&r1=1296812&r2=1296813&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java (original)
+++ tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java Sun Mar  4 14:23:41 2012
@@ -106,12 +106,12 @@ public abstract class StreamInbound impl
     public final SocketState onData() throws IOException {
         // Must be start the start of a message (which may consist of multiple
         // frames)
-
         WsInputStream wsIs = new WsInputStream(processor, getWsOutbound());
-        WsFrame frame = wsIs.nextFrame(true);
 
-        while (frame != null) {
-            try {
+        try {
+            WsFrame frame = wsIs.nextFrame(true);
+
+            while (frame != null) {
                 // TODO User defined extensions may define values for rsv
                 if (frame.getRsv() > 0) {
                     closeOutboundConnection(
@@ -140,21 +140,21 @@ public abstract class StreamInbound impl
                             Constants.STATUS_PROTOCOL_ERROR, null);
                     return SocketState.CLOSED;
                 }
-            } catch (MalformedInputException mie) {
-                // Invalid UTF-8
-                closeOutboundConnection(Constants.STATUS_BAD_DATA, null);
-                return SocketState.CLOSED;
-            } catch (UnmappableCharacterException uce) {
-                // Invalid UTF-8
-                closeOutboundConnection(Constants.STATUS_BAD_DATA, null);
-                return SocketState.CLOSED;
-            } catch (IOException ioe) {
-                // Given something must have gone to reach this point, this
-                // might not work but try it anyway.
-                closeOutboundConnection(Constants.STATUS_PROTOCOL_ERROR, null);
-                return SocketState.CLOSED;
+                frame = wsIs.nextFrame(false);
             }
-            frame = wsIs.nextFrame(false);
+        } catch (MalformedInputException mie) {
+            // Invalid UTF-8
+            closeOutboundConnection(Constants.STATUS_BAD_DATA, null);
+            return SocketState.CLOSED;
+        } catch (UnmappableCharacterException uce) {
+            // Invalid UTF-8
+            closeOutboundConnection(Constants.STATUS_BAD_DATA, null);
+            return SocketState.CLOSED;
+        } catch (IOException ioe) {
+            // Given something must have gone to reach this point, this
+            // might not work but try it anyway.
+            closeOutboundConnection(Constants.STATUS_PROTOCOL_ERROR, null);
+            return SocketState.CLOSED;
         }
         return SocketState.UPGRADED;
     }



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