You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@mina.apache.org by Franjo Stipanovic <fr...@gmail.com> on 2009/12/07 13:10:57 UTC

recover from ProtocolDecoderException

Hi,

is there a way to recover from ProtocolDecoderException? If there's a bad
message structure while decoding I message, I would like to send out
bad_message reply instead of just throwing exception and closing the
session.

Something like this?

  public void exceptionCaught(IoSession session, Throwable t) throws
Exception {
      if (t instanceof ProtocolDecoderException) {
          message = ...
          serviceHandler.prepareBadMessageResponse(message);
          session.write(message);
      } else {
          session.close();
      }

Also, the problem is my request message (I need it for response), I have no
where to store it and retrieve in exceptionCaught.

Any idea?

Kind regards,
fritz