On Mon, 19 Sep 2022 21:02:38 GMT, Naoto Sato <na...@openjdk.org> wrote:
>> src/java.base/share/classes/sun/util/locale/provider/BreakIteratorProviderImpl.java >> line 329: >> >>> 327: @Override >>> 328: public int length() { >>> 329: return src.getEndIndex(); >> >> Could the issue be somewhere else? I mean it feels correct for length = >> endIndex - beginIndex. > > It's somewhat confusing as this class adapts `CharacterIterator` into > `CharSequence` which are similar to each other (thus the bug). Those > `beginIndex`/`endIndex` designate the range in the source > `CharacterIterator`, and this `length()` method should return the entire text > length of the `CharSequence` nevertheless, thus it should start from `0` to > `endIndex`. Yeah, I saw there's a mismatch between the src and limit in this call that led to the index check Exception: 286 for (int b = ci.getBeginIndex(); b < end;) { 287 boundaries.add(b); 288 b = Grapheme.nextBoundary(text, b, end); 289 } and nextBoundary could walk through the entire CharSequence. Maybe it's worth a note to the length() method. ------------- PR: https://git.openjdk.org/jdk/pull/10349