Bug 57118 - Throw EncodeException from RemoteEndpoint.Basic.sendObject()
Summary: Throw EncodeException from RemoteEndpoint.Basic.sendObject()
Alias: None
Product: Tomcat 8
Classification: Unclassified
Component: WebSocket (show other bugs)
Version: 8.0.14
Hardware: PC All
: P2 normal (vote)
Target Milestone: ----
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2014-10-19 18:34 UTC by Konstantin Kolinko
Modified: 2014-10-21 12:36 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
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.