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/01 15:10:45 UTC

svn commit: r1295572 - in /tomcat/trunk/java/org/apache/catalina/websocket: LocalStrings.properties WsFrame.java

Author: markt
Date: Thu Mar  1 14:10:44 2012
New Revision: 1295572

URL: http://svn.apache.org/viewvc?rev=1295572&view=rev
Log:
Explicit handling for end of stream.
Based on review input from kkolinko

Modified:
    tomcat/trunk/java/org/apache/catalina/websocket/LocalStrings.properties
    tomcat/trunk/java/org/apache/catalina/websocket/WsFrame.java

Modified: tomcat/trunk/java/org/apache/catalina/websocket/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/LocalStrings.properties?rev=1295572&r1=1295571&r2=1295572&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/websocket/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/catalina/websocket/LocalStrings.properties Thu Mar  1 14:10:44 2012
@@ -16,6 +16,7 @@
 frame.eos=The end of the stream was reached before the expected number of payload bytes could be read
 frame.invalidUtf8=A sequence of bytes was received that did not represent valid UTF-8
 frame.readFailed=Failed to read the first byte of the next WebSocket frame. The return value from the read was [{0}]
+frame.readEos=The end of the stream was reached when trying to read the first byte of a new WebSocket frame
 frame.notMasked=The client frame was not masked but all client frames must be masked
 
 is.notContinuation=A frame with the OpCode [{0}] was received when a continuation frame was expected

Modified: tomcat/trunk/java/org/apache/catalina/websocket/WsFrame.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/WsFrame.java?rev=1295572&r1=1295571&r2=1295572&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/websocket/WsFrame.java (original)
+++ tomcat/trunk/java/org/apache/catalina/websocket/WsFrame.java Thu Mar  1 14:10:44 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.catalina.websocket;
 
+import java.io.EOFException;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.CharBuffer;
@@ -214,6 +215,8 @@ public class WsFrame {
             return new WsFrame(first[0], processor);
         } else if (read == 0) {
             return null;
+        } else if (read == -1) {
+            throw new EOFException(sm.getString("frame.readEos"));
         } else {
             throw new IOException(
                     sm.getString("frame.readFailed", Integer.valueOf(read)));



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