You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Richard Liang (JIRA)" <ji...@apache.org> on 2006/06/16 08:26:29 UTC

[jira] Created: (HARMONY-610) java.util.regex.Matcher.matches() fails when the default region is changed

java.util.regex.Matcher.matches() fails when the default region is changed
--------------------------------------------------------------------------

         Key: HARMONY-610
         URL: http://issues.apache.org/jira/browse/HARMONY-610
     Project: Harmony
        Type: Bug

  Components: Classlib  
    Reporter: Richard Liang


Hello,
As the spec says, the method of matches () is used to match the entire region against the given pattern.
But if the default region is changed, this method fails when it attempts to match the specified region against the given pattern.

RI 5.0 passes the following test, but Harmony fails.

    public void test_matches() {
        String input = " word ";
        Pattern pattern = Pattern.compile("\\w+");
        Matcher matcher = pattern.matcher(input);
        matcher.region(1, 5);
        assertTrue(matcher.matches());
    }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (HARMONY-610) java.util.regex.Matcher.matches() fails when the default region is changed

Posted by "Richard Liang (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-610?page=comments#action_12418374 ] 

Richard Liang commented on HARMONY-610:
---------------------------------------

Hello Tim,

The fix looks good. Please close this issue.

Thanks a lot.
Richard

> java.util.regex.Matcher.matches() fails when the default region is changed
> --------------------------------------------------------------------------
>
>          Key: HARMONY-610
>          URL: http://issues.apache.org/jira/browse/HARMONY-610
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Richard Liang
>     Assignee: Tim Ellison
>  Attachments: CORRECTED_string_boundaries.patch, regex.src.diff, string_boundaries.patch, string_boundaries.patch
>
> Hello,
> As the spec says, the method of matches () is used to match the entire region against the given pattern.
> But if the default region is changed, this method fails when it attempts to match the specified region against the given pattern.
> RI 5.0 passes the following test, but Harmony fails.
>     public void test_matches() {
>         String input = " word ";
>         Pattern pattern = Pattern.compile("\\w+");
>         Matcher matcher = pattern.matcher(input);
>         matcher.region(1, 5);
>         assertTrue(matcher.matches());
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (HARMONY-610) java.util.regex.Matcher.matches() fails when the default region is changed

Posted by "Nikolay Kuznetsov (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-610?page=all ]

Nikolay Kuznetsov updated HARMONY-610:
--------------------------------------

    Attachment: string_boundaries.patch

The same patch with granted license, sorry.

> java.util.regex.Matcher.matches() fails when the default region is changed
> --------------------------------------------------------------------------
>
>          Key: HARMONY-610
>          URL: http://issues.apache.org/jira/browse/HARMONY-610
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Richard Liang
>  Attachments: string_boundaries.patch, string_boundaries.patch
>
> Hello,
> As the spec says, the method of matches () is used to match the entire region against the given pattern.
> But if the default region is changed, this method fails when it attempts to match the specified region against the given pattern.
> RI 5.0 passes the following test, but Harmony fails.
>     public void test_matches() {
>         String input = " word ";
>         Pattern pattern = Pattern.compile("\\w+");
>         Matcher matcher = pattern.matcher(input);
>         matcher.region(1, 5);
>         assertTrue(matcher.matches());
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (HARMONY-610) java.util.regex.Matcher.matches() fails when the default region is changed

Posted by "Nikolay Kuznetsov (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-610?page=comments#action_12417275 ] 

Nikolay Kuznetsov commented on HARMONY-610:
-------------------------------------------

Tests look good,  assertNotNull(pattern) check is a bit questionable, because Pattern.compile will rather throw exception then return null, but this check is still valid :).


> java.util.regex.Matcher.matches() fails when the default region is changed
> --------------------------------------------------------------------------
>
>          Key: HARMONY-610
>          URL: http://issues.apache.org/jira/browse/HARMONY-610
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Richard Liang
>     Assignee: Tim Ellison
>  Attachments: CORRECTED_string_boundaries.patch, regex.src.diff, string_boundaries.patch, string_boundaries.patch
>
> Hello,
> As the spec says, the method of matches () is used to match the entire region against the given pattern.
> But if the default region is changed, this method fails when it attempts to match the specified region against the given pattern.
> RI 5.0 passes the following test, but Harmony fails.
>     public void test_matches() {
>         String input = " word ";
>         Pattern pattern = Pattern.compile("\\w+");
>         Matcher matcher = pattern.matcher(input);
>         matcher.region(1, 5);
>         assertTrue(matcher.matches());
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (HARMONY-610) java.util.regex.Matcher.matches() fails when the default region is changed

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-610?page=all ]
     
Tim Ellison closed HARMONY-610:
-------------------------------


Verified by Richard.


> java.util.regex.Matcher.matches() fails when the default region is changed
> --------------------------------------------------------------------------
>
>          Key: HARMONY-610
>          URL: http://issues.apache.org/jira/browse/HARMONY-610
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Richard Liang
>     Assignee: Tim Ellison
>  Attachments: CORRECTED_string_boundaries.patch, regex.src.diff, string_boundaries.patch, string_boundaries.patch
>
> Hello,
> As the spec says, the method of matches () is used to match the entire region against the given pattern.
> But if the default region is changed, this method fails when it attempts to match the specified region against the given pattern.
> RI 5.0 passes the following test, but Harmony fails.
>     public void test_matches() {
>         String input = " word ";
>         Pattern pattern = Pattern.compile("\\w+");
>         Matcher matcher = pattern.matcher(input);
>         matcher.region(1, 5);
>         assertTrue(matcher.matches());
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (HARMONY-610) java.util.regex.Matcher.matches() fails when the default region is changed

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-610?page=all ]
     
Tim Ellison resolved HARMONY-610:
---------------------------------

    Resolution: Fixed

Thanks Nikolay,

Patch applied to REGEX module at repo revision r416044.

All existing tests pass ok.

Richard: please verify that this fixes the problem for you (and if you have a regression test that would be good).


> java.util.regex.Matcher.matches() fails when the default region is changed
> --------------------------------------------------------------------------
>
>          Key: HARMONY-610
>          URL: http://issues.apache.org/jira/browse/HARMONY-610
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Richard Liang
>     Assignee: Tim Ellison
>  Attachments: CORRECTED_string_boundaries.patch, string_boundaries.patch, string_boundaries.patch
>
> Hello,
> As the spec says, the method of matches () is used to match the entire region against the given pattern.
> But if the default region is changed, this method fails when it attempts to match the specified region against the given pattern.
> RI 5.0 passes the following test, but Harmony fails.
>     public void test_matches() {
>         String input = " word ";
>         Pattern pattern = Pattern.compile("\\w+");
>         Matcher matcher = pattern.matcher(input);
>         matcher.region(1, 5);
>         assertTrue(matcher.matches());
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (HARMONY-610) java.util.regex.Matcher.matches() fails when the default region is changed

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-610?page=comments#action_12417277 ] 

Tim Ellison commented on HARMONY-610:
-------------------------------------

Additional tests applied to REGEX module at repo revision r416302.

Please check that they have been applied as you expected.


> java.util.regex.Matcher.matches() fails when the default region is changed
> --------------------------------------------------------------------------
>
>          Key: HARMONY-610
>          URL: http://issues.apache.org/jira/browse/HARMONY-610
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Richard Liang
>     Assignee: Tim Ellison
>  Attachments: CORRECTED_string_boundaries.patch, regex.src.diff, string_boundaries.patch, string_boundaries.patch
>
> Hello,
> As the spec says, the method of matches () is used to match the entire region against the given pattern.
> But if the default region is changed, this method fails when it attempts to match the specified region against the given pattern.
> RI 5.0 passes the following test, but Harmony fails.
>     public void test_matches() {
>         String input = " word ";
>         Pattern pattern = Pattern.compile("\\w+");
>         Matcher matcher = pattern.matcher(input);
>         matcher.region(1, 5);
>         assertTrue(matcher.matches());
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (HARMONY-610) java.util.regex.Matcher.matches() fails when the default region is changed

Posted by "Richard Liang (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-610?page=all ]

Richard Liang updated HARMONY-610:
----------------------------------

    Attachment: regex.src.diff

The fix looks good. Thank you, Nikolay & Tim.

Here is the regression tests for Harmony-606, 610 and 625.

> java.util.regex.Matcher.matches() fails when the default region is changed
> --------------------------------------------------------------------------
>
>          Key: HARMONY-610
>          URL: http://issues.apache.org/jira/browse/HARMONY-610
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Richard Liang
>     Assignee: Tim Ellison
>  Attachments: CORRECTED_string_boundaries.patch, regex.src.diff, string_boundaries.patch, string_boundaries.patch
>
> Hello,
> As the spec says, the method of matches () is used to match the entire region against the given pattern.
> But if the default region is changed, this method fails when it attempts to match the specified region against the given pattern.
> RI 5.0 passes the following test, but Harmony fails.
>     public void test_matches() {
>         String input = " word ";
>         Pattern pattern = Pattern.compile("\\w+");
>         Matcher matcher = pattern.matcher(input);
>         matcher.region(1, 5);
>         assertTrue(matcher.matches());
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Assigned: (HARMONY-610) java.util.regex.Matcher.matches() fails when the default region is changed

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-610?page=all ]

Tim Ellison reassigned HARMONY-610:
-----------------------------------

    Assign To: Tim Ellison

> java.util.regex.Matcher.matches() fails when the default region is changed
> --------------------------------------------------------------------------
>
>          Key: HARMONY-610
>          URL: http://issues.apache.org/jira/browse/HARMONY-610
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Richard Liang
>     Assignee: Tim Ellison
>  Attachments: CORRECTED_string_boundaries.patch, string_boundaries.patch, string_boundaries.patch
>
> Hello,
> As the spec says, the method of matches () is used to match the entire region against the given pattern.
> But if the default region is changed, this method fails when it attempts to match the specified region against the given pattern.
> RI 5.0 passes the following test, but Harmony fails.
>     public void test_matches() {
>         String input = " word ";
>         Pattern pattern = Pattern.compile("\\w+");
>         Matcher matcher = pattern.matcher(input);
>         matcher.region(1, 5);
>         assertTrue(matcher.matches());
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (HARMONY-610) java.util.regex.Matcher.matches() fails when the default region is changed

Posted by "Nikolay Kuznetsov (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-610?page=all ]

Nikolay Kuznetsov updated HARMONY-610:
--------------------------------------

    Attachment: string_boundaries.patch

Attached patch contains fix for this issue. The problem here is that matcher used input string length insted of right bound set with region method.

Richard: could you please update regex unit tests with your testcases describing this ussue.

Note:
This patch also fixes issue HARMONY-625

> java.util.regex.Matcher.matches() fails when the default region is changed
> --------------------------------------------------------------------------
>
>          Key: HARMONY-610
>          URL: http://issues.apache.org/jira/browse/HARMONY-610
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Richard Liang
>  Attachments: string_boundaries.patch
>
> Hello,
> As the spec says, the method of matches () is used to match the entire region against the given pattern.
> But if the default region is changed, this method fails when it attempts to match the specified region against the given pattern.
> RI 5.0 passes the following test, but Harmony fails.
>     public void test_matches() {
>         String input = " word ";
>         Pattern pattern = Pattern.compile("\\w+");
>         Matcher matcher = pattern.matcher(input);
>         matcher.region(1, 5);
>         assertTrue(matcher.matches());
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (HARMONY-610) java.util.regex.Matcher.matches() fails when the default region is changed

Posted by "Nikolay Kuznetsov (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-610?page=all ]

Nikolay Kuznetsov updated HARMONY-610:
--------------------------------------

    Attachment: CORRECTED_string_boundaries.patch

Hopefully last one with relative paths to the corrected files.

> java.util.regex.Matcher.matches() fails when the default region is changed
> --------------------------------------------------------------------------
>
>          Key: HARMONY-610
>          URL: http://issues.apache.org/jira/browse/HARMONY-610
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Richard Liang
>  Attachments: CORRECTED_string_boundaries.patch, string_boundaries.patch, string_boundaries.patch
>
> Hello,
> As the spec says, the method of matches () is used to match the entire region against the given pattern.
> But if the default region is changed, this method fails when it attempts to match the specified region against the given pattern.
> RI 5.0 passes the following test, but Harmony fails.
>     public void test_matches() {
>         String input = " word ";
>         Pattern pattern = Pattern.compile("\\w+");
>         Matcher matcher = pattern.matcher(input);
>         matcher.region(1, 5);
>         assertTrue(matcher.matches());
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira