I'm wondering why not set currentDecoder = null before throwing exceptions
here (see below)
...
            if( result == MessageDecoder.OK )
            {
                currentDecoder = null;
                return true;
            }
            else if( result == MessageDecoder.NEED_DATA )
            {
                return false;
            }
            else if( result == MessageDecoder.NOT_OK )
            {
                //^^^^^^^^^^^^^^^^^^^^^^^^^^^
                //I mean here first of all
                throw new ProtocolDecoderException( "Message decoder
returned NOT_OK." );
            }
            else
            {
                //^^^^^^^^^^^^^^^^^^^^^^^^^^^
                //And here possibly
                throw new IllegalStateException( "Unexpected decode result
(see your decode()): " + result );
            }

....

Without this it's not possible to recover codec state after unexpected
message being received.

-- 
View this message in context: 
http://www.nabble.com/DemuxingProtocolCodecFactory.ProtocolDecoderImpl.doDecode-tf4405598s16868.html#a12568709
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.

Reply via email to