TextLineDecoder throws IllegalArgumentException
-----------------------------------------------

                 Key: DIRMINA-343
                 URL: https://issues.apache.org/jira/browse/DIRMINA-343
             Project: MINA
          Issue Type: Bug
          Components: Filter
    Affects Versions: 1.0.1, 1.0.0
            Reporter: Trustin Lee
         Assigned To: Trustin Lee
             Fix For: 1.0.2


A bug report from James Im:

---- MESSAGE BEGINS ----
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.
---- MESSAGE ENDS ----

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to