Author: remm Date: Mon Jan 6 23:40:32 2014 New Revision: 1556071 URL: http://svn.apache.org/r1556071 Log: Avoid NPE if the write listener is called once immediately after being set, even if no data was written (= the app doesn't send any message during the init of the connection). I don't think Tomcat does it yet (this doesn't need to be ported to Tomcat 7 since it is not a Servlet 3.1 impl).
Modified: tomcat/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java Modified: tomcat/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java?rev=1556071&r1=1556070&r2=1556071&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java (original) +++ tomcat/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java Mon Jan 6 23:40:32 2014 @@ -83,6 +83,11 @@ public class WsRemoteEndpointImplServer public void onWritePossible(boolean useDispatch) { + if (buffers == null) { + // Servlet 3.1 will call the write listener once even if nothing + // was written + return; + } boolean complete = true; try { // If this is false there will be a call back when it is true --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org