Author: markt Date: Mon May 26 22:03:54 2014 New Revision: 1597652 URL: http://svn.apache.org/r1597652 Log: ISE is expected when using AsyncChannels. Handle it the same way an IOException is handled rather than expecting the client code to catch and handle it.
Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointImplClient.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointImplClient.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointImplClient.java?rev=1597652&r1=1597651&r2=1597652&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointImplClient.java (original) +++ tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointImplClient.java Mon May 26 22:03:54 2014 @@ -45,8 +45,12 @@ public class WsRemoteEndpointImplClient } SendHandlerToCompletionHandler sh2ch = new SendHandlerToCompletionHandler(handler); - channel.write(data, 0, data.length, timeout, TimeUnit.MILLISECONDS, - null, sh2ch); + try { + channel.write(data, 0, data.length, timeout, TimeUnit.MILLISECONDS, + null, sh2ch); + } catch (IllegalStateException ise) { + sh2ch.failed(ise, null); + } } @Override Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1597652&r1=1597651&r2=1597652&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Mon May 26 22:03:54 2014 @@ -158,6 +158,11 @@ on a POJO based WebSocket endpoint. Based on a suggestion by Eugene Chung. (markt) </scode> + <fix> + When a WebSocket client attempts to write to a closed connection, handle + the resulting <code>IllegalStateException</code> in a manner consistent + with the handling of an <code>IOException</code>. (markt) + </fix> </changelog> </subsection> <subsection name="Other"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org