RFR: 8360070: AccessibleText.getBeforeIndex returns null for last character [v3]

Alexey Ivanov aivanov at openjdk.org
Tue Jun 24 12:21:28 UTC 2025


On Tue, 24 Jun 2025 11:44:13 GMT, Abhishek Kumar <abhiscxk at openjdk.org> wrote:

>> `AccessibleText.getBeforeIndex` method returns `null for last characte`r due to the **wrong boundary value condition check**.
>> This method returns `null` when the `passed index parameter` is equal to `text's length` which is incorrect.
>> `getBeforeIndex` method should return `null` only if the **passed index parameter is less than 0 and greater than the text's length**.
>> 
>> After modifying the condition check, expected character is returned. Test is added to verify the check,
>
> Abhishek Kumar has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Test extended for WORD and SENTENCE

Marked as reviewed by aivanov (Reviewer).

test/jdk/javax/accessibility/TestAccessibleTextBoundaryValue.java line 69:

> 67:         if (!expected.equals(actual)) {
> 68:             throw new RuntimeException("The actual result does not match " +
> 69:                     "the expected result.");

Why not include the values in the error message?

Suggestion:

            throw new RuntimeException("Result doesn't match: '" + actual + "' vs. '" + expected + "'");

-------------

PR Review: https://git.openjdk.org/jdk/pull/25941#pullrequestreview-2953565277
PR Review Comment: https://git.openjdk.org/jdk/pull/25941#discussion_r2163825211


More information about the client-libs-dev mailing list