[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.
|