harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Ellison (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (HARMONY-4396) [classlib][regex] Matcher.hitEnd() returns invalid value if a match isn't found after find() method is called
Date Tue, 30 Oct 2007 16:46:50 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-4396?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Tim Ellison resolved HARMONY-4396.
----------------------------------

    Resolution: Fixed

Finally integrated regression test case, with my humble apologies for the delay.

Committed to REGEX module at repo revision r590138.


> [classlib][regex] Matcher.hitEnd() returns invalid value if a match isn't found after
find() method is called
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4396
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: OS: Linux openSUSE 10.2, JDK 1.6
>            Reporter: Radu Marias
>            Assignee: Tim Ellison
>            Priority: Minor
>         Attachments: HitEndTest.java, Matcher.java
>
>
> If Matcher.find() is called and there's no match found, the Matcher.hitEnd() returns
false event thought when it's tried to get the index of the match that index is -1 (witch
means that a match isn't found).
> The problem is that matchResult.hitEnd isn't set to true when the index of found match
is -1.
> The fix is a little change to "private int findAt(int startIndex)" method to set matchResult.hitEnd
to true when a match isn't found.
> The source of changed method:
>     private int findAt(int startIndex) {
>         matchResult.reset();
>         matchResult.setMode(Matcher.MODE_FIND);
>         matchResult.setStartIndex(startIndex);
>         int foundIndex = start.find(startIndex, string, matchResult);
>         if (foundIndex == -1) {
>             matchResult.hitEnd = true;
>         }
>         return foundIndex;
>     }
> Attachments:
> HitEndTest.java: test case, testHitEndAfterFind() is the test it fails.
> Matcher.java: the fixed file.

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


Mime
View raw message