users@grizzly.java.net

Grizzly 2.2.2 WebSocket implementation catches all exceptions without letting the user know

From: <justphilmusic_at_googlemail.com>
Date: Mon, 11 Jun 2012 12:46:52 +0000 (GMT)

Hello everybody,

I'm about to write an application that is based on Grizzly's WebSocket
implementation and I realized that it is a pain to debug my own
application due to the fact that the WebSocket implementation catches
all exceptions that are thrown in my code, without giving me a hint
that an exception has actually been thrown.

Consider the following WebSocketApplication sub class:


public class MyApplication extends WebSocketApplication {

// other overridden methods that are omitted for brevity reasons

@Override
        public void onMessage(WebSocket socket, String data) {
                
                assert false : "this is unfortunately catched by
grizzly";
                
                throw new RuntimeException("and this one also");

}

}


As an API user I never get to know that something went wrong without
explicitly catching these exceptions by myself. That's obviously not
that cool because e.g. it is not possible to use Java's assertion
mechanism anymore.

This behavior can be spotted in Grizzly 2.2.2. I haven't tested any
newer versions yet.


So, is this actually expected behavior? Is there a possibility to tell
Grizzly NOT to drive the "catch all" policy?


Thanks in advance!

Philipp