You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Trustin Lee (JIRA)" <ji...@apache.org> on 2007/01/29 04:23:49 UTC
[jira] Created: (DIRMINA-343) TextLineDecoder throws
IllegalArgumentException
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.
[jira] Closed: (DIRMINA-343) TextLineDecoder throws
IllegalArgumentException
Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-343?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Trustin Lee closed DIRMINA-343.
-------------------------------
Resolution: Fixed
I checked in the fix. Here's the test case that shows two counter examples:
ttp://tinyurl.com/2ttf7u
And the following is how I fixed this problem:
http://tinyurl.com/3yabl2
oldMatchCount had been introduced to minimize memory copy, but it brought a side effect that delimiter position is miscalculated in some tricky case. Now I changed the implementation to copy the delimiter into the temp buffer and exclude the delimiter when string is parsed.
> 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.0, 1.0.1
> 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.