You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Mark Hindess (JIRA)" <ji...@apache.org> on 2010/05/20 13:55:53 UTC

[jira] Created: (HARMONY-6515) [classlib][regex] incorrect/confusing Pattern matching behaviour

[classlib][regex] incorrect/confusing Pattern matching behaviour
----------------------------------------------------------------

                 Key: HARMONY-6515
                 URL: https://issues.apache.org/jira/browse/HARMONY-6515
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
    Affects Versions: 5.0M13
            Reporter: Mark Hindess
             Fix For: 5.0M15


All of the following should print true:

        P = Pattern.compile("^(?:a{1}:){5}a$");
        System.out.println("P = "+P);
        System.out.println("Simple char with 5 separators: "+P.matcher("a:a:a:a:a:a").matches());
        P = Pattern.compile("^(?:[a]:){5}a$");
        System.out.println(" Char class with 5 separators: "+P.matcher("a:a:a:a:a:a").matches());
        P = Pattern.compile("^(?:[a]{1}:){5}a$");
        System.out.println(" Char class w/{1} and 5 sep/s: "+P.matcher("a:a:a:a:a:a").matches());
        P = Pattern.compile("^(?:[a]{1}:){4}a$");
        System.out.println(" Char class w/{1} and 4 sep/s: "+P.matcher("a:a:a:a:a").matches());
        P = Pattern.compile("^(?:[a]{1,4}:){4}a$");
        System.out.println(" Char class w/{1,4} + 4 sep/s: "+P.matcher("a:a:a:a:a").matches());
        P = Pattern.compile("^(?:[a]{1,4}:){5}a$");
        System.out.println(" Char class w/{1,4} + 5 sep/s: "+P.matcher("a:a:a:a:a:a").matches());

but on harmony they print:

  Simple char with 5 separators: true
   Char class with 5 separators: true
   Char class w/{1} and 5 sep/s: false
   Char class w/{1} and 4 sep/s: false
   Char class w/{1,4} + 4 sep/s: true
   Char class w/{1,4} + 5 sep/s: false

(Yes.  That's right just changing the {4} to {5} and adding an extra 'a:' to the string causes the last one
to break.)

I found this while running the Apache HttpComponents HttpClient 4.1-alpha2 tests on the (potential) milestone releases.


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


[jira] Updated: (HARMONY-6515) [classlib][regex] incorrect/confusing Pattern matching behaviour

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-6515?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tim Ellison updated HARMONY-6515:
---------------------------------

    Fix Version/s:     (was: 5.0M15)

> [classlib][regex] incorrect/confusing Pattern matching behaviour
> ----------------------------------------------------------------
>
>                 Key: HARMONY-6515
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6515
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M13
>            Reporter: Mark Hindess
>
> All of the following should print true:
>         P = Pattern.compile("^(?:a{1}:){5}a$");
>         System.out.println("P = "+P);
>         System.out.println("Simple char with 5 separators: "+P.matcher("a:a:a:a:a:a").matches());
>         P = Pattern.compile("^(?:[a]:){5}a$");
>         System.out.println(" Char class with 5 separators: "+P.matcher("a:a:a:a:a:a").matches());
>         P = Pattern.compile("^(?:[a]{1}:){5}a$");
>         System.out.println(" Char class w/{1} and 5 sep/s: "+P.matcher("a:a:a:a:a:a").matches());
>         P = Pattern.compile("^(?:[a]{1}:){4}a$");
>         System.out.println(" Char class w/{1} and 4 sep/s: "+P.matcher("a:a:a:a:a").matches());
>         P = Pattern.compile("^(?:[a]{1,4}:){4}a$");
>         System.out.println(" Char class w/{1,4} + 4 sep/s: "+P.matcher("a:a:a:a:a").matches());
>         P = Pattern.compile("^(?:[a]{1,4}:){5}a$");
>         System.out.println(" Char class w/{1,4} + 5 sep/s: "+P.matcher("a:a:a:a:a:a").matches());
> but on harmony they print:
>   Simple char with 5 separators: true
>    Char class with 5 separators: true
>    Char class w/{1} and 5 sep/s: false
>    Char class w/{1} and 4 sep/s: false
>    Char class w/{1,4} + 4 sep/s: true
>    Char class w/{1,4} + 5 sep/s: false
> (Yes.  That's right just changing the {4} to {5} and adding an extra 'a:' to the string causes the last one
> to break.)
> I found this while running the Apache HttpComponents HttpClient 4.1-alpha2 tests on the (potential) milestone releases.

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