|
Quick Lists
|
|
Bug ID:
|
6635133
|
|
Votes
|
0
|
|
Synopsis
|
Exception thrown when using a Unicode escape
|
|
Category
|
java:classes_util_regex
|
|
Reported Against
|
|
|
Release Fixed
|
7(b27)
|
|
State
|
10-Fix Delivered,
bug
|
|
Priority:
|
4-Low
|
|
Related Bugs
|
|
|
Submit Date
|
28-NOV-2007
|
|
Description
|
FULL PRODUCT VERSION :
java version "1.6.0_02"
Java(TM) SE Runtime Environment (build 1.6.0_02-b06)
Java HotSpot(TM) Client VM (build 1.6.0_02-b06, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
customer Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
The following examples is OK.
System.out.println("\uD834\uDD22".matches("[\\uD834\\uDD21-\uD834\uDD24]+"));
but, the following examples, PatternSyntaxException is generated.
System.out.println("\uD834\uDD21".matches("[\\uD834\\uDD21-\\uD834\\uDD22]+"));
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the following.
import java.util.regex.Pattern;
public class Sample {
// U+1D121 is \uD834\uDD21
public static void main(String[] args) {
System.out.println("\uD834\uDD22".matches("[\\uD834\\uDD21-\uD834\uDD24]+"));
System.out.println("\uD834\uDD21".matches("[\\uD834\\uDD21-\uD834\uDD22]+"));
}
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
true
true
ACTUAL -
true
Exception in thread "main" java.util.regex.PatternSyntaxException: Illegal character range near index 19
[\uD834\uDD21-\uD834\uDD22]+
^
at java.util.regex.Pattern.error(Unknown Source)
at java.util.regex.Pattern.range(Unknown Source)
at java.util.regex.Pattern.clazz(Unknown Source)
at java.util.regex.Pattern.sequence(Unknown Source)
at java.util.regex.Pattern.expr(Unknown Source)
at java.util.regex.Pattern.compile(Unknown Source)
at java.util.regex.Pattern.<init>(Unknown Source)
at java.util.regex.Pattern.compile(Unknown Source)
at java.util.regex.Pattern.matches(Unknown Source)
at java.lang.String.matches(Unknown Source)
at Sample.main(Sample.java:10)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.regex.Pattern;
public class Sample {
// U+1D121 is \uD834\uDD21
public static void main(String[] args) {
System.out.println("\uD834\uDD22".matches("[\\uD834\\uDD21-\uD834\uDD24]+"));
System.out.println("\uD834\uDD21".matches("[\\uD834\\uDD21-\uD834\uDD22]+"));
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
The upper example shows.
Posted Date : 2007-11-28 23:58:03.0
|
|
Work Around
|
N/A
|
|
Evaluation
|
The utility method Pattern.u() does not understand surrogates.
Posted Date : 2007-11-29 00:30:50.0
|
|
Comments
|
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |