On 01/12/2014 17:56, r...@apache.org wrote: > Author: remm > Date: Mon Dec 1 17:56:10 2014 > New Revision: 1642722 > > URL: http://svn.apache.org/r1642722 > Log: > Don't call onMessage on whole empty messages.
What is the justification for this? RFC 6455 permits zero length messages. There is nothing in the Java WebSocket spec I can recall that permits zero length messages to be skipped. Mark > > Modified: > tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java > > Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java > URL: > http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java?rev=1642722&r1=1642721&r2=1642722&view=diff > ============================================================================== > --- tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java (original) > +++ tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java Mon Dec 1 > 17:56:10 2014 > @@ -390,8 +390,10 @@ public abstract class WsFrameBase { > messageBufferText.toString(), last); > } else { > // Caller ensures last == true if this branch is used > - ((MessageHandler.Whole<String>) textMsgHandler).onMessage( > - messageBufferText.toString()); > + if (messageBufferText.remaining() > 0) { > + ((MessageHandler.Whole<String>) > textMsgHandler).onMessage( > + messageBufferText.toString()); > + } > } > } catch (Throwable t) { > handleThrowableOnSend(t); > @@ -583,7 +585,9 @@ public abstract class WsFrameBase { > ((MessageHandler.Partial<ByteBuffer>) > binaryMsgHandler).onMessage(msg, last); > } else { > // Caller ensures last == true if this branch is used > - ((MessageHandler.Whole<ByteBuffer>) > binaryMsgHandler).onMessage(msg); > + if (msg.remaining() > 0) { > + ((MessageHandler.Whole<ByteBuffer>) > binaryMsgHandler).onMessage(msg); > + } > } > } catch(Throwable t) { > handleThrowableOnSend(t); > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > For additional commands, e-mail: dev-h...@tomcat.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org