RFR: 8330462: StringIndexOutOfBoundException when typing anything into TextField [v15]

Oliver Kopp duke at openjdk.org
Tue Apr 23 15:02:39 UTC 2024


On Tue, 23 Apr 2024 12:17:55 GMT, Oliver Kopp <duke at openjdk.org> wrote:

>> Fixes https://bugs.openjdk.org/browse/JDK-8330462.
>> 
>> If the parameter `maxLength` is larger than `Integer.MAX_VALUE - start`, then an addition of `start` to it leads to a negative value. This is "fixed" by using `Math.max` comparing the `maxLength` and `maxLength + start`.
>
> Oliver Kopp has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add missing exports

I was thinking about diving into this accessible area. Did not find any existing test and wanted to start with something small (in `test.javafx.scene.control.TextFieldTest`).


    @Test public void setTextAndSeeValueAccessible() throws Exception {
        StackPane stackPane = new StackPane();
        Scene scene = new Scene(stackPane);
        Accessible accessible = SceneHelper.getAccessible(scene);
        TextField textField = new TextField();
        stackPane.getChildren().add(textField);
        textField.setText("This is a test");
        assertEquals("This is a test", accessible.getAttribute(AccessibleAttribute.TEXT));
    }


Fails, because `SceneHelper.getAccessible(scene)` returns `null`. I am not that much into the accessibility activation things - and did not find any accessibility tests.

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

PR Comment: https://git.openjdk.org/jfx/pull/1442#issuecomment-2072595295


More information about the openjfx-dev mailing list