directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trustin Lee (JIRA)" <>
Subject [jira] Commented: (DIRMINA-45) DemuxingProtocolCodecFactory.doDecode returns wrong value
Date Sat, 21 May 2005 02:40:55 GMT
     [ ]
Trustin Lee commented on DIRMINA-45:

This behavior is correct.

Let's assume that there are 3 and half messages in the buffer.

'OK' means 'I decoded one complete message correctly'.  You decode one message and return
'OK'.  DemuxingProtocolCodecFactory calls doDecode once more to decode remaining buffer. 
You return two more OKs decoding two message and it will cause the internal implementation
return 'true' so that the loop continue.  Now you've got half message left which is incomplete.
 DemusingProtocolCodecFactory calls once again if your decoder can decode the remaining data.
 You find out you cannot decode the half message because you need the whole message, and return
NEED_DATA.  NEED_DATA will be translated into 'return false', and the loop ends.  doDecode
will be called later when more data is received.

Do you understand what's going on?  Please leave some comment.  I'll add this documentation
to JavaDoc if you think it is OK.  Please confirm the JavaDoc and then close this issue.


> DemuxingProtocolCodecFactory.doDecode returns wrong value
> ---------------------------------------------------------
>          Key: DIRMINA-45
>          URL:
>      Project: Directory MINA
>         Type: Bug
>     Versions: 0.7.1
>  Environment: JDK1.4.2
>     Reporter: Alex
>     Assignee: Trustin Lee

> I am not sure if it is a bug or I just misunderstood something.
> I am implementing a protocol and use Demuxing* classes.
> When I return MessageDecoder.OK from my MessageDecoder's decode method, MINA tries repeatedly
calls this method again. If I return MessageDecoder.NEED_DATA everything goes fine.
> So, I would expect completely reversal behaviour.
> I checked CumulativeProtocolDecoder and DemuxingProtocolCodecFactory classes.
> In CumulativeProtocolDecoder.decode it says that doDecode is invoked repeatedly until
it returns false. Fine. But what "false" means here? I would guess that it means that buffer
was completely decoded and no more data is needed. But DemuxingProtocolCodedFactory.doDecode
returns true if decoder returned MessageDecoder.OK and false if decoder returned MessageDecoder.NEED_DATA.
Isn't wrong here?
> Alex

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message