You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Evgeniya Maenkova (JIRA)" <ji...@apache.org> on 2007/02/08 19:44:05 UTC

[jira] Created: (HARMONY-3145) [regex] java.util.regex.Pattern failed to compile "(\\P{all})+" pattern unlike RI

[regex] java.util.regex.Pattern failed to compile "(\\P{all})+" pattern unlike RI
---------------------------------------------------------------------------------

                 Key: HARMONY-3145
                 URL: https://issues.apache.org/jira/browse/HARMONY-3145
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Evgeniya Maenkova
         Attachments: Pattern1.java

The test is: [to be attached]

import java.util.regex.Pattern;

public class Pattern1 {
	public static void main(String[] args) throws Exception {
		int[] codePoint = new int[1];
		Pattern p = Pattern.compile("(\\p{all})+");		
		boolean res = true;
		int cnt = 0;
		String s;
		for (int i =0; i < 0x110000; i ++) {
			codePoint[0] = i;
			s = new String(codePoint, 0, 1);
			if (!s.matches(p.toString())) {
				cnt++;
				res = false;
			}
		}
		System.out.println(res + " " + Integer.toHexString(cnt));
		
		p = Pattern.compile("(\\P{all})+");		
		res = true;
		cnt = 0;
		
		for (int i =0; i < 0x110000; i ++) {
			codePoint[0] = i;
			s = new String(codePoint, 0, 1);			
			if (!s.matches(p.toString())) {
				cnt++;
				res = false;
			}
		}		 
		
		
		System.out.println(res + " " + Integer.toHexString(cnt)); 		 
			
	}
}

DRL output:
Uncaught exception in main:
java.util.regex.PatternSyntaxException: Character Class \p{all} is not supported near index: 8
(\p{all})+
        ^
        at java.util.regex.Lexer.movePointer(Lexer.java:564)
        at java.util.regex.Lexer.<init>(Lexer.java:225)
        at java.util.regex.Pattern.compileImpl(Pattern.java:279)
        at java.util.regex.Pattern.compile(Pattern.java:264)
        at java.util.regex.Pattern.compile(Pattern.java)
        at Pattern1.main(Pattern1.java:5)

RI output:
true 0
false 110000


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


[jira] Resolved: (HARMONY-3145) [regex] java.util.regex.Pattern failed to compile "(\\P{all})+" pattern unlike RI

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

Alexey Petrenko resolved HARMONY-3145.
--------------------------------------

    Resolution: Fixed

The patch has been applied. Please verify.

> [regex] java.util.regex.Pattern failed to compile "(\\P{all})+" pattern unlike RI
> ---------------------------------------------------------------------------------
>
>                 Key: HARMONY-3145
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3145
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Evgeniya Maenkova
>         Assigned To: Alexey Petrenko
>         Attachments: Pattern1.java, regex.patch, regex.patch
>
>
> The test is: [to be attached]
> import java.util.regex.Pattern;
> public class Pattern1 {
> 	public static void main(String[] args) throws Exception {
> 		int[] codePoint = new int[1];
> 		Pattern p = Pattern.compile("(\\p{all})+");		
> 		boolean res = true;
> 		int cnt = 0;
> 		String s;
> 		for (int i =0; i < 0x110000; i ++) {
> 			codePoint[0] = i;
> 			s = new String(codePoint, 0, 1);
> 			if (!s.matches(p.toString())) {
> 				cnt++;
> 				res = false;
> 			}
> 		}
> 		System.out.println(res + " " + Integer.toHexString(cnt));
> 		
> 		p = Pattern.compile("(\\P{all})+");		
> 		res = true;
> 		cnt = 0;
> 		
> 		for (int i =0; i < 0x110000; i ++) {
> 			codePoint[0] = i;
> 			s = new String(codePoint, 0, 1);			
> 			if (!s.matches(p.toString())) {
> 				cnt++;
> 				res = false;
> 			}
> 		}		 
> 		
> 		
> 		System.out.println(res + " " + Integer.toHexString(cnt)); 		 
> 			
> 	}
> }
> DRL output:
> Uncaught exception in main:
> java.util.regex.PatternSyntaxException: Character Class \p{all} is not supported near index: 8
> (\p{all})+
>         ^
>         at java.util.regex.Lexer.movePointer(Lexer.java:564)
>         at java.util.regex.Lexer.<init>(Lexer.java:225)
>         at java.util.regex.Pattern.compileImpl(Pattern.java:279)
>         at java.util.regex.Pattern.compile(Pattern.java:264)
>         at java.util.regex.Pattern.compile(Pattern.java)
>         at Pattern1.main(Pattern1.java:5)
> RI output:
> true 0
> false 110000

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


[jira] Updated: (HARMONY-3145) [regex] java.util.regex.Pattern failed to compile "(\\P{all})+" pattern unlike RI

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

Evgeniya Maenkova updated HARMONY-3145:
---------------------------------------

    Attachment: Pattern1.java

test

> [regex] java.util.regex.Pattern failed to compile "(\\P{all})+" pattern unlike RI
> ---------------------------------------------------------------------------------
>
>                 Key: HARMONY-3145
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3145
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Evgeniya Maenkova
>         Attachments: Pattern1.java
>
>
> The test is: [to be attached]
> import java.util.regex.Pattern;
> public class Pattern1 {
> 	public static void main(String[] args) throws Exception {
> 		int[] codePoint = new int[1];
> 		Pattern p = Pattern.compile("(\\p{all})+");		
> 		boolean res = true;
> 		int cnt = 0;
> 		String s;
> 		for (int i =0; i < 0x110000; i ++) {
> 			codePoint[0] = i;
> 			s = new String(codePoint, 0, 1);
> 			if (!s.matches(p.toString())) {
> 				cnt++;
> 				res = false;
> 			}
> 		}
> 		System.out.println(res + " " + Integer.toHexString(cnt));
> 		
> 		p = Pattern.compile("(\\P{all})+");		
> 		res = true;
> 		cnt = 0;
> 		
> 		for (int i =0; i < 0x110000; i ++) {
> 			codePoint[0] = i;
> 			s = new String(codePoint, 0, 1);			
> 			if (!s.matches(p.toString())) {
> 				cnt++;
> 				res = false;
> 			}
> 		}		 
> 		
> 		
> 		System.out.println(res + " " + Integer.toHexString(cnt)); 		 
> 			
> 	}
> }
> DRL output:
> Uncaught exception in main:
> java.util.regex.PatternSyntaxException: Character Class \p{all} is not supported near index: 8
> (\p{all})+
>         ^
>         at java.util.regex.Lexer.movePointer(Lexer.java:564)
>         at java.util.regex.Lexer.<init>(Lexer.java:225)
>         at java.util.regex.Pattern.compileImpl(Pattern.java:279)
>         at java.util.regex.Pattern.compile(Pattern.java:264)
>         at java.util.regex.Pattern.compile(Pattern.java)
>         at Pattern1.main(Pattern1.java:5)
> RI output:
> true 0
> false 110000

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


[jira] Updated: (HARMONY-3145) [regex] java.util.regex.Pattern failed to compile "(\\P{all})+" pattern unlike RI

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

Evgeniya Maenkova updated HARMONY-3145:
---------------------------------------

    Attachment: regex.patch

unit test added

> [regex] java.util.regex.Pattern failed to compile "(\\P{all})+" pattern unlike RI
> ---------------------------------------------------------------------------------
>
>                 Key: HARMONY-3145
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3145
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Evgeniya Maenkova
>         Assigned To: Alexey Petrenko
>         Attachments: Pattern1.java, regex.patch, regex.patch
>
>
> The test is: [to be attached]
> import java.util.regex.Pattern;
> public class Pattern1 {
> 	public static void main(String[] args) throws Exception {
> 		int[] codePoint = new int[1];
> 		Pattern p = Pattern.compile("(\\p{all})+");		
> 		boolean res = true;
> 		int cnt = 0;
> 		String s;
> 		for (int i =0; i < 0x110000; i ++) {
> 			codePoint[0] = i;
> 			s = new String(codePoint, 0, 1);
> 			if (!s.matches(p.toString())) {
> 				cnt++;
> 				res = false;
> 			}
> 		}
> 		System.out.println(res + " " + Integer.toHexString(cnt));
> 		
> 		p = Pattern.compile("(\\P{all})+");		
> 		res = true;
> 		cnt = 0;
> 		
> 		for (int i =0; i < 0x110000; i ++) {
> 			codePoint[0] = i;
> 			s = new String(codePoint, 0, 1);			
> 			if (!s.matches(p.toString())) {
> 				cnt++;
> 				res = false;
> 			}
> 		}		 
> 		
> 		
> 		System.out.println(res + " " + Integer.toHexString(cnt)); 		 
> 			
> 	}
> }
> DRL output:
> Uncaught exception in main:
> java.util.regex.PatternSyntaxException: Character Class \p{all} is not supported near index: 8
> (\p{all})+
>         ^
>         at java.util.regex.Lexer.movePointer(Lexer.java:564)
>         at java.util.regex.Lexer.<init>(Lexer.java:225)
>         at java.util.regex.Pattern.compileImpl(Pattern.java:279)
>         at java.util.regex.Pattern.compile(Pattern.java:264)
>         at java.util.regex.Pattern.compile(Pattern.java)
>         at Pattern1.main(Pattern1.java:5)
> RI output:
> true 0
> false 110000

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


[jira] Commented: (HARMONY-3145) [regex] java.util.regex.Pattern failed to compile "(\\P{all})+" pattern unlike RI

Posted by "Evgeniya Maenkova (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-3145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12471635 ] 

Evgeniya Maenkova commented on HARMONY-3145:
--------------------------------------------

Test shows (\p{all})+ pattern matches all Unicode symbols in the 0x00-0x10FFFF range.  And no symbols match with (\P{all})+. So "all" means range 0x00-0x10FFFF.
Because of this one more range added to java.util.regex.AbstractCharClass fix this problem (see patch).

> [regex] java.util.regex.Pattern failed to compile "(\\P{all})+" pattern unlike RI
> ---------------------------------------------------------------------------------
>
>                 Key: HARMONY-3145
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3145
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Evgeniya Maenkova
>         Assigned To: Alexey Petrenko
>         Attachments: Pattern1.java, regex.patch
>
>
> The test is: [to be attached]
> import java.util.regex.Pattern;
> public class Pattern1 {
> 	public static void main(String[] args) throws Exception {
> 		int[] codePoint = new int[1];
> 		Pattern p = Pattern.compile("(\\p{all})+");		
> 		boolean res = true;
> 		int cnt = 0;
> 		String s;
> 		for (int i =0; i < 0x110000; i ++) {
> 			codePoint[0] = i;
> 			s = new String(codePoint, 0, 1);
> 			if (!s.matches(p.toString())) {
> 				cnt++;
> 				res = false;
> 			}
> 		}
> 		System.out.println(res + " " + Integer.toHexString(cnt));
> 		
> 		p = Pattern.compile("(\\P{all})+");		
> 		res = true;
> 		cnt = 0;
> 		
> 		for (int i =0; i < 0x110000; i ++) {
> 			codePoint[0] = i;
> 			s = new String(codePoint, 0, 1);			
> 			if (!s.matches(p.toString())) {
> 				cnt++;
> 				res = false;
> 			}
> 		}		 
> 		
> 		
> 		System.out.println(res + " " + Integer.toHexString(cnt)); 		 
> 			
> 	}
> }
> DRL output:
> Uncaught exception in main:
> java.util.regex.PatternSyntaxException: Character Class \p{all} is not supported near index: 8
> (\p{all})+
>         ^
>         at java.util.regex.Lexer.movePointer(Lexer.java:564)
>         at java.util.regex.Lexer.<init>(Lexer.java:225)
>         at java.util.regex.Pattern.compileImpl(Pattern.java:279)
>         at java.util.regex.Pattern.compile(Pattern.java:264)
>         at java.util.regex.Pattern.compile(Pattern.java)
>         at Pattern1.main(Pattern1.java:5)
> RI output:
> true 0
> false 110000

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


[jira] Updated: (HARMONY-3145) [regex] java.util.regex.Pattern failed to compile "(\\P{all})+" pattern unlike RI

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

Evgeniya Maenkova updated HARMONY-3145:
---------------------------------------

    Attachment: regex.patch

patch for regex

> [regex] java.util.regex.Pattern failed to compile "(\\P{all})+" pattern unlike RI
> ---------------------------------------------------------------------------------
>
>                 Key: HARMONY-3145
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3145
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Evgeniya Maenkova
>         Attachments: Pattern1.java, regex.patch
>
>
> The test is: [to be attached]
> import java.util.regex.Pattern;
> public class Pattern1 {
> 	public static void main(String[] args) throws Exception {
> 		int[] codePoint = new int[1];
> 		Pattern p = Pattern.compile("(\\p{all})+");		
> 		boolean res = true;
> 		int cnt = 0;
> 		String s;
> 		for (int i =0; i < 0x110000; i ++) {
> 			codePoint[0] = i;
> 			s = new String(codePoint, 0, 1);
> 			if (!s.matches(p.toString())) {
> 				cnt++;
> 				res = false;
> 			}
> 		}
> 		System.out.println(res + " " + Integer.toHexString(cnt));
> 		
> 		p = Pattern.compile("(\\P{all})+");		
> 		res = true;
> 		cnt = 0;
> 		
> 		for (int i =0; i < 0x110000; i ++) {
> 			codePoint[0] = i;
> 			s = new String(codePoint, 0, 1);			
> 			if (!s.matches(p.toString())) {
> 				cnt++;
> 				res = false;
> 			}
> 		}		 
> 		
> 		
> 		System.out.println(res + " " + Integer.toHexString(cnt)); 		 
> 			
> 	}
> }
> DRL output:
> Uncaught exception in main:
> java.util.regex.PatternSyntaxException: Character Class \p{all} is not supported near index: 8
> (\p{all})+
>         ^
>         at java.util.regex.Lexer.movePointer(Lexer.java:564)
>         at java.util.regex.Lexer.<init>(Lexer.java:225)
>         at java.util.regex.Pattern.compileImpl(Pattern.java:279)
>         at java.util.regex.Pattern.compile(Pattern.java:264)
>         at java.util.regex.Pattern.compile(Pattern.java)
>         at Pattern1.main(Pattern1.java:5)
> RI output:
> true 0
> false 110000

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


[jira] Assigned: (HARMONY-3145) [regex] java.util.regex.Pattern failed to compile "(\\P{all})+" pattern unlike RI

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

Alexey Petrenko reassigned HARMONY-3145:
----------------------------------------

    Assignee: Alexey Petrenko

> [regex] java.util.regex.Pattern failed to compile "(\\P{all})+" pattern unlike RI
> ---------------------------------------------------------------------------------
>
>                 Key: HARMONY-3145
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3145
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Evgeniya Maenkova
>         Assigned To: Alexey Petrenko
>         Attachments: Pattern1.java, regex.patch
>
>
> The test is: [to be attached]
> import java.util.regex.Pattern;
> public class Pattern1 {
> 	public static void main(String[] args) throws Exception {
> 		int[] codePoint = new int[1];
> 		Pattern p = Pattern.compile("(\\p{all})+");		
> 		boolean res = true;
> 		int cnt = 0;
> 		String s;
> 		for (int i =0; i < 0x110000; i ++) {
> 			codePoint[0] = i;
> 			s = new String(codePoint, 0, 1);
> 			if (!s.matches(p.toString())) {
> 				cnt++;
> 				res = false;
> 			}
> 		}
> 		System.out.println(res + " " + Integer.toHexString(cnt));
> 		
> 		p = Pattern.compile("(\\P{all})+");		
> 		res = true;
> 		cnt = 0;
> 		
> 		for (int i =0; i < 0x110000; i ++) {
> 			codePoint[0] = i;
> 			s = new String(codePoint, 0, 1);			
> 			if (!s.matches(p.toString())) {
> 				cnt++;
> 				res = false;
> 			}
> 		}		 
> 		
> 		
> 		System.out.println(res + " " + Integer.toHexString(cnt)); 		 
> 			
> 	}
> }
> DRL output:
> Uncaught exception in main:
> java.util.regex.PatternSyntaxException: Character Class \p{all} is not supported near index: 8
> (\p{all})+
>         ^
>         at java.util.regex.Lexer.movePointer(Lexer.java:564)
>         at java.util.regex.Lexer.<init>(Lexer.java:225)
>         at java.util.regex.Pattern.compileImpl(Pattern.java:279)
>         at java.util.regex.Pattern.compile(Pattern.java:264)
>         at java.util.regex.Pattern.compile(Pattern.java)
>         at Pattern1.main(Pattern1.java:5)
> RI output:
> true 0
> false 110000

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


[jira] Closed: (HARMONY-3145) [regex] java.util.regex.Pattern failed to compile "(\\P{all})+" pattern unlike RI

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

Evgeniya Maenkova closed HARMONY-3145.
--------------------------------------


Works fine. Thanks, Alexey.

> [regex] java.util.regex.Pattern failed to compile "(\\P{all})+" pattern unlike RI
> ---------------------------------------------------------------------------------
>
>                 Key: HARMONY-3145
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3145
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Evgeniya Maenkova
>         Assigned To: Alexey Petrenko
>         Attachments: Pattern1.java, regex.patch, regex.patch
>
>
> The test is: [to be attached]
> import java.util.regex.Pattern;
> public class Pattern1 {
> 	public static void main(String[] args) throws Exception {
> 		int[] codePoint = new int[1];
> 		Pattern p = Pattern.compile("(\\p{all})+");		
> 		boolean res = true;
> 		int cnt = 0;
> 		String s;
> 		for (int i =0; i < 0x110000; i ++) {
> 			codePoint[0] = i;
> 			s = new String(codePoint, 0, 1);
> 			if (!s.matches(p.toString())) {
> 				cnt++;
> 				res = false;
> 			}
> 		}
> 		System.out.println(res + " " + Integer.toHexString(cnt));
> 		
> 		p = Pattern.compile("(\\P{all})+");		
> 		res = true;
> 		cnt = 0;
> 		
> 		for (int i =0; i < 0x110000; i ++) {
> 			codePoint[0] = i;
> 			s = new String(codePoint, 0, 1);			
> 			if (!s.matches(p.toString())) {
> 				cnt++;
> 				res = false;
> 			}
> 		}		 
> 		
> 		
> 		System.out.println(res + " " + Integer.toHexString(cnt)); 		 
> 			
> 	}
> }
> DRL output:
> Uncaught exception in main:
> java.util.regex.PatternSyntaxException: Character Class \p{all} is not supported near index: 8
> (\p{all})+
>         ^
>         at java.util.regex.Lexer.movePointer(Lexer.java:564)
>         at java.util.regex.Lexer.<init>(Lexer.java:225)
>         at java.util.regex.Pattern.compileImpl(Pattern.java:279)
>         at java.util.regex.Pattern.compile(Pattern.java:264)
>         at java.util.regex.Pattern.compile(Pattern.java)
>         at Pattern1.main(Pattern1.java:5)
> RI output:
> true 0
> false 110000

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