RFR: 8330462: StringIndexOutOfBoundException when typing anything into TextField [v9]
Oliver Kopp
duke at openjdk.org
Fri Apr 19 18:35:03 UTC 2024
On Fri, 19 Apr 2024 17:57:09 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
>> Oliver Kopp has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Fix test
>
> modules/javafx.graphics/src/main/java/com/sun/glass/ui/win/WinTextRangeProvider.java line 378:
>
>> 376: if (text == null) return null;
>> 377: validateRange(text);
>> 378: int endOffset = getValidStringIndex(start, maxLength, end);
>
> If I presume the arguments are (start, length, maxLength), the last two arguments on this line only need to be swapped. They seem to be correct on LL 394, 498.
`maxLength` is the parameter of the `GetText` method. The caller asks for the text, but only with `maxLength` length. Therefore, `start + maxLength`. `end` is the real end of the current string. After `end` there are no characters. Ensured by `validateRange`.
I can add a comment. I love to add comments, but I learned at https://github.com/openjdk/jdk/pull/10704 that only higher-level comments are desired...
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1442#discussion_r1572761689
More information about the openjfx-dev
mailing list