You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Adam Hathcock <ha...@auburn.edu> on 2005/05/29 20:02:18 UTC

[mina] Possible issue/fix with DemuxingProtocolCodecFactory

I kept getting the IllegalStateException: "doDecode can't return true  
when buffer is not consumed" from the CumulativeProtocolDecoder which  
is used by the DemuxingProtocolCodec Factory (which I'm using in my  
current project :).  I think I narrowed down the problem to these  
lines starting at about line 229 in DemuxingProtocolCodec.java:

int limit = in.limit();
in.position( 0 );
MessageDecoderResult result = decoder.decodable( session, in );
in.position( 0 );
in.limit( limit );

I changed the 2nd and 4th lines so that the code is now:

int limit = in.limit();
int pos = in.position();
MessageDecoderResult result = decoder.decodable( session, in );
in.position( pos );
in.limit( limit );

Admittingly, I do not know what all this affects but it seems like  
that the in buffer shouldn't have its position set to zero everytime  
you check to see if the decoder can decode the message.  It seems  
like the buffer will have more than just a single message starting at  
zero.  I changed my local copy and I do not get the exception  
anymore.  If this breaks design and my code has the fault, let me know.

Thanks,

Adam


Re: [mina] Possible issue/fix with DemuxingProtocolCodecFactory

Posted by Trustin Lee <tr...@gmail.com>.
Hi Adam,

2005/5/30, Adam Hathcock <ha...@auburn.edu>: 
> 
> I kept getting the IllegalStateException: "doDecode can't return true when 
> buffer is not consumed" from the CumulativeProtocolDecoder which is used by 
> the DemuxingProtocolCodec Factory (which I'm using in my current project :). 
> I think I narrowed down the problem to these lines starting at about line 
> 229 in DemuxingProtocolCodec.java:
> 
 Thank you so much for your help! That was I was tracking all day. :) I 
checked in the fix. Could you try the latest jar?
 Thanks,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/