< prev index next >
src/java.base/share/classes/java/util/regex/Pattern.java
Print this page
rev 56113 : imported patch 8230338-Accurate-error-message-about-bad-Unicode-block-name
*** 2886,2910 ****
if (name.startsWith("In")) {
// \p{InBlockName}
p = CharPredicates.forUnicodeBlock(name.substring(2));
} else if (name.startsWith("Is")) {
// \p{IsGeneralCategory} and \p{IsScriptName}
! name = name.substring(2);
! p = CharPredicates.forUnicodeProperty(name);
if (p == null)
! p = CharPredicates.forProperty(name);
if (p == null)
! p = CharPredicates.forUnicodeScript(name);
} else {
if (has(UNICODE_CHARACTER_CLASS)) {
p = CharPredicates.forPOSIXName(name);
}
if (p == null)
p = CharPredicates.forProperty(name);
}
if (p == null)
! throw error("Unknown character property name {In/Is" + name + "}");
}
if (isComplement) {
// it might be too expensive to detect if a complement of
// CharProperty can match "certain" supplementary. So just
// go with StartS.
--- 2886,2910 ----
if (name.startsWith("In")) {
// \p{InBlockName}
p = CharPredicates.forUnicodeBlock(name.substring(2));
} else if (name.startsWith("Is")) {
// \p{IsGeneralCategory} and \p{IsScriptName}
! String shortName = name.substring(2);
! p = CharPredicates.forUnicodeProperty(shortName);
if (p == null)
! p = CharPredicates.forProperty(shortName);
if (p == null)
! p = CharPredicates.forUnicodeScript(shortName);
} else {
if (has(UNICODE_CHARACTER_CLASS)) {
p = CharPredicates.forPOSIXName(name);
}
if (p == null)
p = CharPredicates.forProperty(name);
}
if (p == null)
! throw error("Unknown character property name {" + name + "}");
}
if (isComplement) {
// it might be too expensive to detect if a complement of
// CharProperty can match "certain" supplementary. So just
// go with StartS.
< prev index next >