-
Bug
-
Resolution: Fixed
-
P4
-
11, 17, 21, 23
-
b22
The class sun.font.CharSequenceCodePointIterator is not used anywhere in the JDK.
Also it has (at least) one bug which would
cause an exception if a hi surrogate were the last char
public int next() {
if (index < text.length()) {
char cp1 = text.charAt(index++);
if (Character.isHighSurrogate(cp1) && index < text.length()) {
char cp2 = text.charAt(index+1); /// <<< Should not be "+1"
if (Character.isLowSurrogate(cp2)) {
++index;
return Character.toCodePoint(cp1, cp2);
}
}
return cp1;
}
return DONE;
}
We could fix it, but it wouldn't help anyone and it would be hard to test.
It might be best to just delete the class.
Since we've not needed it in 2 decades I doubt we'll ever need it.
Also it has (at least) one bug which would
cause an exception if a hi surrogate were the last char
public int next() {
if (index < text.length()) {
char cp1 = text.charAt(index++);
if (Character.isHighSurrogate(cp1) && index < text.length()) {
char cp2 = text.charAt(index+1); /// <<< Should not be "+1"
if (Character.isLowSurrogate(cp2)) {
++index;
return Character.toCodePoint(cp1, cp2);
}
}
return cp1;
}
return DONE;
}
We could fix it, but it wouldn't help anyone and it would be hard to test.
It might be best to just delete the class.
Since we've not needed it in 2 decades I doubt we'll ever need it.