Bug 57118

Summary: Throw EncodeException from RemoteEndpoint.Basic.sendObject()
Product: Tomcat 8 Reporter: Konstantin Kolinko <knst.kolinko>
Component: WebSocketAssignee: Tomcat Developers Mailing List <dev>
Severity: normal    
Priority: P2    
Version: 8.0.14   
Target Milestone: ----   
Hardware: PC   
OS: All   

Description Konstantin Kolinko 2014-10-19 18:34:48 UTC
(Noted when updating documentation in r1632965)

The method javax.websocket.RemoteEndpoint.Basic.sendObject(Object) is expected to throw EncodeException if there is no suitable encoder configured for the object type.

The actual implementation in org.apache.tomcat.websocket.WsRemoteEndpointBasic.sendObject(Object) does not throw that exception, because the method that is called there does not throw it. It is not even declares a "throws" for it, and it is a checked exception.

My understanding is that the exception is passed to a competition handler, but it is not properly unwrapped. An IOException is thrown instead.
Comment 1 Mark Thomas 2014-10-21 12:36:34 UTC
This has been fixed in 8.0.x for 8.0.15 onwards and in 7.0.x for 7.0.57 onwards.