On 1/28/07, James Im <[EMAIL PROTECTED]> wrote:
Trustin Lee wrote: >Hi James, > >On 1/23/07, James Im <[EMAIL PROTECTED]> 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 No, I'm not sure that we need to reset oldMatchCount whenever we reset matchCount. I rather beleive that oldMatchCount must be reset after a call to: "in.limit( pos - matchCount + oldMatchCount );" How to be sure?
Well, I wrote some unit tests and made them pass. I used a little bit different approach, which is simpler and easier to understand. I hope you like it. http://issues.apache.org/jira/browse/DIRMINA-306 BTW, how do you do a patch? If you are working with svn working copy, running 'svn diff' will generate a patch file for you. Otherwise, you can use 'diff -u' command. 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
