RFR: 8360070: AccessibleText.getBeforeIndex returns null for last character
Abhishek Kumar
abhiscxk at openjdk.org
Tue Jun 24 11:36:27 UTC 2025
On Mon, 23 Jun 2025 23:24:14 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
> I am not sure about the statement above. I think the check should take care of the direction, which is -1 in your case
I think the check is to ensure the passed index parameter is to verify the boundary of text length.
> This is actually properly handled by the code below(in t he same method you changed):
If the `index` is equal to the the `text length`, the returned character from the `getBeforeIndex` should return the last character i.e. 6 but the existing condition evaluates to `true` due to `index equals to model.getLength()` and method returns `null`. So, even the `direction` is handled correctly below, execution doesn't reach to that point.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25941#issuecomment-2999976301
More information about the client-libs-dev
mailing list