[TYRUS-253]  DecodeException is not passed to @OnError method from session.getAsyncRemote().sendObject Created: 17/Sep/13  Updated: 17/Sep/13  Resolved: 17/Sep/13

Status: Resolved
Project: tyrus
Component/s: core
Affects Version/s: 1.2.1
Fix Version/s: 1.3

Type: Bug Priority: Major
Reporter: jan.supol Assignee: Pavel Bucek
Resolution: Works as designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
is related to TYRUS-251 DecodeException is not passed to @OnE... Resolved

@ServerEndpoint(value = "/textstreamencoder", encoders = { ThrowingTextStreamEncoder.class })
public class WSCTextStreamEncoderServer {

	public void echo(String data, Session session) {
		session.getAsyncRemote().sendObject(new StringBean(data));

	public void onError(Session session, Throwable t) throws IOException {
		String message = "TEST ERROR";

public class ThrowingTextStreamEncoder implements TextStream<StringBean> {

	public void encode(StringBean bean, Writer writer) throws EncodeException,
			IOException {
		throw new EncodeException(bean.get(), "ERROR");

public class StringBean {
	private String value;

	public String get() {
		return value;

	public StringBean(String value) {
		this.value = value;

Comment by jan.supol [ 17/Sep/13 ]

looks like the same issue as TYRUS-251, except TYRUS-251 is about getBasicRemote().sendObject() and this is about getAsyncRemote().sendObject()

Comment by Pavel Bucek [ 17/Sep/13 ]

AsyncRemoteEndpoint.sendObject has different javadoc than BasicRemoteEndpoint alternative. You need to store returned future and call get(). Encode exception will be present as a cause of thrown ExecutionException.

Generated at Tue May 03 10:07:51 UTC 2016 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.