Hi Pavel,
The version bundled in Glassfish 4.1 indeed works as expected. I guess I'll
put that in the known issues for my project (use GF 4.1 or update the
bundled tyrus).
Sorry for the trouble!!! I should have made sure I was testing the latest
version first. Though the java.net source repository really confused me
(it's the first google hit for "tyrus source code"). If at all possible,
consider have it removed. so that other people clueless like me don't make
the same mistake. :-)
Thanks!
Gabriele
From: Pavel Bucek [mailto:pavel.bucek_at_oracle.com]
Sent: Monday, November 17, 2014 4:59 PM
To: users_at_tyrus.java.net
Subject: Re: Decoders and DecodeException
Hi Gabriele,
can you please state which version of Tyrus are you using?
Sources you are referencing are kind of old - we moved to GIT some time ago,
see [1] or (easily browsable) github mirror [2].
As for described issue - I found a test for that, please see [3], line 119,
method testDecodeException(). Is that different compared to your usecase? If
so, how? Ideally, if you still can reproduce the issue with latest release,
please include code snippet.
Thanks and regards,
Pavel
[1]
https://java.net/projects/tyrus/sources/code/show
[2]
https://github.com/tyrus-project/tyrus
[3]
https://github.com/tyrus-project/tyrus/blob/e7d822d3aee4dcdcf2df0b0ed7c70123
ad9023c5/tests/e2e/standard-config/src/test/java/org/glassfish/tyrus/test/st
andard_config/DecodedObjectTest.java#L119
On 17/11/14 22:28, Gabriele Carcassi wrote:
Hi!
In the process of implementing error handling on my websocket, I am trying
to send proper error messages to the client in case the format is incorrect.
The idea is that I publish the spec of my websocket, I have no control of
who implements what client, so I need to cover the error cases as well.
My expectation is that, for each DecodeException, my @OnError is called so
that I can properly wire the exception handling. Instead, I am noticing that
the DecodeExceptions thrown by the decoders seems to be disappear in the
framework. Looking at the code, EndpointWrapper:
https://java.net/projects/tyrus/sources/source-code-repository/content/trunk
/core/src/main/java/org/glassfish/tyrus/core/EndpointWrapper.java?rev=762
calls the decoder, and just adds the exceptions to the ErrorCollector:
https://java.net/projects/tyrus/sources/source-code-repository/content/trunk
/core/src/main/java/org/glassfish/tyrus/core/ErrorCollector.java?rev=762
After that, I do not see that they result in notifications on the
WSEndpoint. As of now, they seem to be silently ignored (unless you turn on
the logging), which I don't feel is right.
Here:
https://docs.oracle.com/javaee/7/api/javax/websocket/Endpoint.html#onError%2
8javax.websocket.Session,%20java.lang.Throwable%29
says one type of errors are "conversion errors encoding incoming messages
before any message handler has been called. These are modeled as
DecodeExceptions". Which seems to suggest my expectation was right. But I am
not sure.
As a workaround, I am creating the decoder myself, hooking it up to the
@OnOpen/_at_OnMessage/_at_OnClose. It works, but it's less than ideal.
Should I consider this behavior a bug (and report it as such)? Or is it
intended?
Thanks!
Gabriele