提交 10d3d1c4 编写于 作者: P peytoia

8020037: String.toLowerCase incorrectly increases length, if string contains \u0130 char

Reviewed-by: naoto
上级 9105f3d8
...@@ -74,7 +74,6 @@ final class ConditionalSpecialCasing { ...@@ -74,7 +74,6 @@ final class ConditionalSpecialCasing {
new Entry(0x00CC, new char[]{0x0069, 0x0307, 0x0300}, new char[]{0x00CC}, "lt", 0), // # LATIN CAPITAL LETTER I WITH GRAVE new Entry(0x00CC, new char[]{0x0069, 0x0307, 0x0300}, new char[]{0x00CC}, "lt", 0), // # LATIN CAPITAL LETTER I WITH GRAVE
new Entry(0x00CD, new char[]{0x0069, 0x0307, 0x0301}, new char[]{0x00CD}, "lt", 0), // # LATIN CAPITAL LETTER I WITH ACUTE new Entry(0x00CD, new char[]{0x0069, 0x0307, 0x0301}, new char[]{0x00CD}, "lt", 0), // # LATIN CAPITAL LETTER I WITH ACUTE
new Entry(0x0128, new char[]{0x0069, 0x0307, 0x0303}, new char[]{0x0128}, "lt", 0), // # LATIN CAPITAL LETTER I WITH TILDE new Entry(0x0128, new char[]{0x0069, 0x0307, 0x0303}, new char[]{0x0128}, "lt", 0), // # LATIN CAPITAL LETTER I WITH TILDE
new Entry(0x0130, new char[]{0x0069, 0x0307}, new char[]{0x0130}, "lt", 0), // # LATIN CAPITAL LETTER I WITH DOT ABOVE
//# ================================================================================ //# ================================================================================
//# Turkish and Azeri //# Turkish and Azeri
...@@ -85,10 +84,7 @@ final class ConditionalSpecialCasing { ...@@ -85,10 +84,7 @@ final class ConditionalSpecialCasing {
new Entry(0x0049, new char[]{0x0131}, new char[]{0x0049}, "tr", NOT_BEFORE_DOT), // # LATIN CAPITAL LETTER I new Entry(0x0049, new char[]{0x0131}, new char[]{0x0049}, "tr", NOT_BEFORE_DOT), // # LATIN CAPITAL LETTER I
new Entry(0x0049, new char[]{0x0131}, new char[]{0x0049}, "az", NOT_BEFORE_DOT), // # LATIN CAPITAL LETTER I new Entry(0x0049, new char[]{0x0131}, new char[]{0x0049}, "az", NOT_BEFORE_DOT), // # LATIN CAPITAL LETTER I
new Entry(0x0069, new char[]{0x0069}, new char[]{0x0130}, "tr", 0), // # LATIN SMALL LETTER I new Entry(0x0069, new char[]{0x0069}, new char[]{0x0130}, "tr", 0), // # LATIN SMALL LETTER I
new Entry(0x0069, new char[]{0x0069}, new char[]{0x0130}, "az", 0), // # LATIN SMALL LETTER I new Entry(0x0069, new char[]{0x0069}, new char[]{0x0130}, "az", 0) // # LATIN SMALL LETTER I
//# ================================================================================
//# Other
new Entry(0x0130, new char[]{0x0069, 0x0307}, new char[]{0x0130}, "en", 0), // # LATIN CAPITALLETTER I WITH DOT ABOVE
}; };
// A hash table that contains the above entries // A hash table that contains the above entries
......
...@@ -2598,21 +2598,14 @@ public final class String ...@@ -2598,21 +2598,14 @@ public final class String
} }
if (localeDependent || srcChar == '\u03A3') { // GREEK CAPITAL LETTER SIGMA if (localeDependent || srcChar == '\u03A3') { // GREEK CAPITAL LETTER SIGMA
lowerChar = ConditionalSpecialCasing.toLowerCaseEx(this, i, locale); lowerChar = ConditionalSpecialCasing.toLowerCaseEx(this, i, locale);
} else if (srcChar == '\u0130') { // LATIN CAPITAL LETTER I DOT
lowerChar = Character.ERROR;
} else { } else {
lowerChar = Character.toLowerCase(srcChar); lowerChar = Character.toLowerCase(srcChar);
} }
if ((lowerChar == Character.ERROR) if ((lowerChar == Character.ERROR)
|| (lowerChar >= Character.MIN_SUPPLEMENTARY_CODE_POINT)) { || (lowerChar >= Character.MIN_SUPPLEMENTARY_CODE_POINT)) {
if (lowerChar == Character.ERROR) { if (lowerChar == Character.ERROR) {
if (!localeDependent && srcChar == '\u0130') { lowerCharArray =
lowerCharArray = ConditionalSpecialCasing.toLowerCaseCharArray(this, i, locale);
ConditionalSpecialCasing.toLowerCaseCharArray(this, i, Locale.ENGLISH);
} else {
lowerCharArray =
ConditionalSpecialCasing.toLowerCaseCharArray(this, i, locale);
}
} else if (srcCount == 2) { } else if (srcCount == 2) {
resultOffset += Character.toChars(lowerChar, result, i + resultOffset) - srcCount; resultOffset += Character.toChars(lowerChar, result, i + resultOffset) - srcCount;
continue; continue;
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
/* /*
@test @test
@bug 4217441 4533872 4900935 @bug 4217441 4533872 4900935 8020037
@summary toLowerCase should lower-case Greek Sigma correctly depending @summary toLowerCase should lower-case Greek Sigma correctly depending
on the context (final/non-final). Also it should handle on the context (final/non-final). Also it should handle
Locale specific (lt, tr, and az) lowercasings and supplementary Locale specific (lt, tr, and az) lowercasings and supplementary
...@@ -69,10 +69,11 @@ public class ToLowerCase { ...@@ -69,10 +69,11 @@ public class ToLowerCase {
test("\u00CD", Locale.US, "\u00ED"); test("\u00CD", Locale.US, "\u00ED");
test("\u0128", Locale.US, "\u0129"); test("\u0128", Locale.US, "\u0129");
// I-dot tests (Turkish and Azeri) // I-dot tests
test("\u0130", turkish, "i"); test("\u0130", turkish, "i");
test("\u0130", az, "i"); test("\u0130", az, "i");
test("\u0130", Locale.US, "i\u0307"); test("\u0130", lt, "i");
test("\u0130", Locale.US, "i");
// Remove dot_above in the sequence I + dot_above (Turkish and Azeri) // Remove dot_above in the sequence I + dot_above (Turkish and Azeri)
test("I\u0307", turkish, "i"); test("I\u0307", turkish, "i");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册