Hello I am writing a client implementation for a binary protocol using a ProtocolCodecFilter with a DemuxingProtocolCodecFactory and a list of MessageDecoder's in the same way as the Mina SumUp example. I also use a DemuxingIoHandler to handle the responses and I am in general very pleased with how this works.
My question is as follows. If I for some reason get an exception in one of my MessageDecoder's decode()-method due to a broken response of some sort, what is supposed to happen next? What happens for me is that the exception is passed to my ExceptionHandler and decoding of this message quits. Fine so far. But the subsequent decode operation (following a new request) is immediately passed on to the same MessageDecoder instance's decode(). This is of course a problem if the next response is of another type because the chain of MessageDecoder's decodable() are never called. Also it sometimes seems as if remaining bytes in the IoBuffer from decoding#1 (that threw Exception) are still in the buffer in decoding#2 and my decoding crashes (again). I interpret the Javadoc for MessageDecoder.decode() as if throwing exception would mean roughly the same thing as returning MessageDecoderResult.NOT_OK. Do they not both indicate a "protocol specification violation"? It seems as throwing exception in the decode()-method acts more like returning MessageDecoderResult.NEED_DATA. I quess I can solve this problem by catching all exceptions in decode() and returning MessageDecoderResult.NOT_OK but then my ExceptionHandler is never called. Is this the supposed behavior or am I misunderstanding something here? I am using Mina version 2.0.1 (have tried 2.0.0-RC1 too), Windows 7 and jdk1.6.0_18. Thanks in advance! /Björn
