You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by James Im <im...@hotmail.com> on 2007/01/22 17:21:43 UTC
TextLineDecoder bug?
I need your help to determine if I have found a bug or not.
I use a slightly modified version of TextLineDecoder and I got an error
in decodeNormal() at line 272 (the line number correspond to the version
on the trunk):
in.limit( in.limit() - matchCount + oldMatchCount );
After investigating a bit I found that I was trying to set the limit to
8193 which was greater than the capacity (8192). Thus the error.
I've investigated some more and I saw that it happened when the
matchCount passed to decodeNormal() was 1 instead of 0.
I've investigated some more and I think that oldMatchCount should be
reset to zero when you have found a match.
Thus, after line 261 I have added:
oldMatchCount=0;
After I did this change the problem was solved. The problem did not
occurred 100% of the time on my server and thus I have no specific test
case to reproduce the problem.
As it is hard to analyze buffer, position, limit, remaining and capacity
in loops and I therefore ask you to do a mental effort to verify if I
am right or wrong.
_________________________________________________________________
Del dine store filer uden problemer pĺ MSN Messenger:
http://messenger.msn.dk/
Re: TextLineDecoder bug?
Posted by Trustin Lee <tr...@gmail.com>.
Hi James,
On 1/23/07, James Im <im...@hotmail.com> wrote:
>
> I need your help to determine if I have found a bug or not.
>
> I use a slightly modified version of TextLineDecoder and I got an error
> in decodeNormal() at line 272 (the line number correspond to the version
> on the trunk):
>
> in.limit( in.limit() - matchCount + oldMatchCount );
>
>
> After investigating a bit I found that I was trying to set the limit to
> 8193 which was greater than the capacity (8192). Thus the error.
>
> I've investigated some more and I saw that it happened when the
> matchCount passed to decodeNormal() was 1 instead of 0.
>
> I've investigated some more and I think that oldMatchCount should be
> reset to zero when you have found a match.
>
> Thus, after line 261 I have added:
> oldMatchCount=0;
Thank you for reporting a bug. I agree with you that it's a bug. Don't we
need to reset oldMatchCount whenever we reset matchCount, instead of adding
one sentence in line 261?
It would also be the best if you can create a JIRA issue for us, and attach
a patch file.
Thanks,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41 4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4 455E 1C62 A7DC 0255 ECA6