mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-05 21:50:20 +00:00
8160312: ArrayIndexOutOfBoundsException when comparing strings case insensitive
Reviewed-by: rriggs
This commit is contained in:
parent
396d6f6285
commit
6223e843f9
@ -137,8 +137,8 @@ final class StringLatin1 {
|
||||
char c1 = (char) CharacterDataLatin1.instance.toUpperCase(getChar(value, k));
|
||||
char c2 = (char) CharacterDataLatin1.instance.toUpperCase(getChar(other, k));
|
||||
if (c1 != c2) {
|
||||
c1 = (char) CharacterDataLatin1.instance.toLowerCase(c1);
|
||||
c2 = (char) CharacterDataLatin1.instance.toLowerCase(c2);
|
||||
c1 = Character.toLowerCase(c1);
|
||||
c2 = Character.toLowerCase(c2);
|
||||
if (c1 != c2) {
|
||||
return c1 - c2;
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 4124769
|
||||
* @bug 4124769 8160312
|
||||
* @summary Test ignore-case comparison
|
||||
*
|
||||
*/
|
||||
@ -45,6 +45,10 @@ public class CompareIC {
|
||||
comparer.testTriplet(test1, test2, test3);
|
||||
test2 = test2.toLowerCase();
|
||||
comparer.testTriplet(test1, test2, test3);
|
||||
|
||||
// toLowerCase -> non-latin1
|
||||
if ("\u00b5".compareToIgnoreCase("X") < 0)
|
||||
throw new RuntimeException("Comparison failure1");
|
||||
}
|
||||
|
||||
private void testTriplet(String one, String two, String three)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user