You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Igor Grigoryev <gr...@gmail.com> on 2007/09/08 13:14:10 UTC

DemuxingProtocolCodecFactory.ProtocolDecoderImpl.doDecode

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.


Re: DemuxingProtocolCodecFactory.ProtocolDecoderImpl.doDecode

Posted by Trustin Lee <tr...@gmail.com>.
On 9/8/07, Igor Grigoryev <gr...@gmail.com> wrote:
>
> 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.

Thanks for pointing out the bug.  It's resolved now, and the fix will
be included in the next release.

https://issues.apache.org/jira/browse/DIRMINA-436

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6