Author: remm
Date: Fri Oct 17 16:51:49 2014
New Revision: 1632634
URL: http://svn.apache.org/r1632634
Log:
Add null checks for arguments in remote endpoint.
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties?rev=1632634&r1=1632633&r2=1632634&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties
Fri Oct 17 16:51:49 2014
@@ -72,6 +72,8 @@ wsRemoteEndpoint.flushOnCloseFailed=Flus
wsRemoteEndpoint.invalidEncoder=The specified encoder of type [{0}] could not
be instantiated
wsRemoteEndpoint.noEncoder=No encoder specified for object of class [{0}]
wsRemoteEndpoint.wrongState=The remote endpoint was in state [{0}] which is an
invalid state for called method
+wsRemoteEndpoint.nullData=Invalid null data argument
+wsRemoteEndpoint.nullHandler=Invalid null handler argument
# Note the following message is used as a close reason in a WebSocket control
# frame and therefore must be 123 bytes (not characters) or less in length.
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java?rev=1632634&r1=1632633&r2=1632634&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
Fri Oct 17 16:51:49 2014
@@ -125,6 +125,9 @@ public abstract class WsRemoteEndpointIm
public void sendBytes(ByteBuffer data) throws IOException {
+ if (data == null) {
+ throw new
IllegalArgumentException(sm.getString("wsRemoteEndpoint.nullData"));
+ }
stateMachine.binaryStart();
startMessageBlock(Constants.OPCODE_BINARY, data, true);
stateMachine.complete(true);
@@ -139,6 +142,12 @@ public abstract class WsRemoteEndpointIm
public void sendBytesByCompletion(ByteBuffer data, SendHandler handler) {
+ if (data == null) {
+ throw new
IllegalArgumentException(sm.getString("wsRemoteEndpoint.nullData"));
+ }
+ if (handler == null) {
+ throw new
IllegalArgumentException(sm.getString("wsRemoteEndpoint.nullHandler"));
+ }
StateUpdateSendHandler sush = new StateUpdateSendHandler(handler);
stateMachine.binaryStart();
startMessage(Constants.OPCODE_BINARY, data, true, sush);
@@ -147,6 +156,9 @@ public abstract class WsRemoteEndpointIm
public void sendPartialBytes(ByteBuffer partialByte, boolean last)
throws IOException {
+ if (partialByte == null) {
+ throw new
IllegalArgumentException(sm.getString("wsRemoteEndpoint.nullData"));
+ }
stateMachine.binaryPartialStart();
startMessageBlock(Constants.OPCODE_BINARY, partialByte, last);
stateMachine.complete(last);
@@ -168,6 +180,9 @@ public abstract class WsRemoteEndpointIm
public void sendString(String text) throws IOException {
+ if (text == null) {
+ throw new
IllegalArgumentException(sm.getString("wsRemoteEndpoint.nullData"));
+ }
stateMachine.textStart();
sendPartialString(CharBuffer.wrap(text), true);
}
@@ -181,6 +196,12 @@ public abstract class WsRemoteEndpointIm
public void sendStringByCompletion(String text, SendHandler handler) {
+ if (text == null) {
+ throw new
IllegalArgumentException(sm.getString("wsRemoteEndpoint.nullData"));
+ }
+ if (handler == null) {
+ throw new
IllegalArgumentException(sm.getString("wsRemoteEndpoint.nullHandler"));
+ }
stateMachine.textStart();
TextMessageSendHandler tmsh = new TextMessageSendHandler(handler,
CharBuffer.wrap(text), true, encoder, encoderBuffer, this);
@@ -191,6 +212,9 @@ public abstract class WsRemoteEndpointIm
public void sendPartialString(String fragment, boolean isLast)
throws IOException {
+ if (fragment == null) {
+ throw new
IllegalArgumentException(sm.getString("wsRemoteEndpoint.nullData"));
+ }
stateMachine.textPartialStart();
sendPartialString(CharBuffer.wrap(fragment), isLast);
}
Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1632634&r1=1632633&r2=1632634&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Fri Oct 17 16:51:49 2014
@@ -373,6 +373,12 @@
Update the WebSocket implementation to support the Java WebSocket
specification version 1.1. (markt)
</update>
+ <fix>
+ Fix client subprotocol handling. (remm)
+ </fix>
+ <fix>
+ Add null checks for arguments in remote endpoint. (remm)
+ </fix>
</changelog>
</subsection>
<subsection name="Web applications">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]