RFR: JDK-8325798: Spinner throws uncatchable exception on tab out from garbled text
Michael Strauß
mstrauss at openjdk.org
Tue Feb 13 22:48:03 UTC 2024
On Tue, 13 Feb 2024 20:42:08 GMT, Marius Hanl <mhanl at openjdk.org> wrote:
> When a `Spinner` is configured with e.g. Integers (`IntegerSpinnerValueFactory`) and the user types in a `String`, e.g. 'abc' and focuses another `Node`, an exception is thrown (`NumberFormatException`).
> This exception is literally uncatchable, as it happens on focus lost.
>
> The issue is the same as for the `DatePicker` component described in [JDK-8303478](https://bugs.openjdk.org/browse/JDK-8303478), which was fixed in PR: https://github.com/openjdk/jfx/pull/1274.
>
> I did the exact same fix in this PR. Also added the same test.
LGTM
modules/javafx.controls/src/test/java/test/javafx/scene/control/SpinnerTest.java line 1588:
> 1586:
> 1587: /**
> 1588: * When Spinner looses focus with misformatted text in the editor,
typo: loses
modules/javafx.controls/src/test/java/test/javafx/scene/control/SpinnerTest.java line 1609:
> 1607: spinner.getEditor().setText("2abc");
> 1608:
> 1609: // loosing focus triggers cancelEdit() because the text cannot be parsed
typo: losing
-------------
Marked as reviewed by mstrauss (Committer).
PR Review: https://git.openjdk.org/jfx/pull/1365#pullrequestreview-1879077791
PR Review Comment: https://git.openjdk.org/jfx/pull/1365#discussion_r1488678419
PR Review Comment: https://git.openjdk.org/jfx/pull/1365#discussion_r1488678809
More information about the openjfx-dev
mailing list