-
Bug
-
Resolution: Unresolved
-
P4
-
jfx11.0.26, 8u431, jfx23
-
None
-
os_x
Possibly related to JDK-8336348: when a TextField has a TextFormatter set, running on macOS with Korean language (2-Set Korean), after typing some characters and, in composition mode, pressing backspace, there is an exception:
2025-01-21 11:58:24.916 java[40702:2986408] +[IMKClient subclass]: chose IMKClient_Modern
2025-01-21 11:58:24.916 java[40702:2986408] +[IMKInputSession subclass]: chose IMKInputSession_Modern
2025-01-21 11:58:26.739 java[40702:2986408] error messaging the mach port for IMKCFRunLoopWakeUpReliable
Exception in thread "JavaFX Application Thread" java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:55)
at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:52)
at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)
at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Preconditions.java:112)
at java.base/jdk.internal.util.Preconditions.checkFromToIndex(Preconditions.java:349)
at java.base/java.lang.AbstractStringBuilder.substring(AbstractStringBuilder.java:1093)
at java.base/java.lang.StringBuilder.substring(StringBuilder.java:91)
at javafx.controls@24-ea/javafx.scene.control.TextField$TextFieldContent.get(TextField.java:80)
at javafx.controls@24-ea/javafx.scene.control.TextInputControl.getText(TextInputControl.java:504)
at javafx.controls@24-ea/javafx.scene.control.TextInputControl.updateContent(TextInputControl.java:610)
at javafx.controls@24-ea/javafx.scene.control.TextInputControl.replaceText(TextInputControl.java:601)
at javafx.controls@24-ea/javafx.scene.control.TextInputControl.replaceText(TextInputControl.java:560)
at javafx.controls@24-ea/javafx.scene.control.skin.TextInputControlSkin.handleInputMethodEvent(TextInputControlSkin.java:773)
at javafx.base@24-ea/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
The attached test reproduces the issue:
- On macOS, select input source 2-Set Korean
- Run the application, type 'ㄴ' ("s" key), and type 'ㅇ' ("d" key). Note that composition mode starts. See "enter_composition_mode.png"
- Press backspace, the composition mode ends (see "remove_composition_mode.png"), but the exception is thrown.
Expected: when pressing the back key, the composition mode ends and there is no exception thrown
Observed: when pressing the back key, the composition mode ends and there is an exception thrown
2025-01-21 11:58:24.916 java[40702:2986408] +[IMKClient subclass]: chose IMKClient_Modern
2025-01-21 11:58:24.916 java[40702:2986408] +[IMKInputSession subclass]: chose IMKInputSession_Modern
2025-01-21 11:58:26.739 java[40702:2986408] error messaging the mach port for IMKCFRunLoopWakeUpReliable
Exception in thread "JavaFX Application Thread" java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:55)
at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:52)
at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)
at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Preconditions.java:112)
at java.base/jdk.internal.util.Preconditions.checkFromToIndex(Preconditions.java:349)
at java.base/java.lang.AbstractStringBuilder.substring(AbstractStringBuilder.java:1093)
at java.base/java.lang.StringBuilder.substring(StringBuilder.java:91)
at javafx.controls@24-ea/javafx.scene.control.TextField$TextFieldContent.get(TextField.java:80)
at javafx.controls@24-ea/javafx.scene.control.TextInputControl.getText(TextInputControl.java:504)
at javafx.controls@24-ea/javafx.scene.control.TextInputControl.updateContent(TextInputControl.java:610)
at javafx.controls@24-ea/javafx.scene.control.TextInputControl.replaceText(TextInputControl.java:601)
at javafx.controls@24-ea/javafx.scene.control.TextInputControl.replaceText(TextInputControl.java:560)
at javafx.controls@24-ea/javafx.scene.control.skin.TextInputControlSkin.handleInputMethodEvent(TextInputControlSkin.java:773)
at javafx.base@24-ea/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
The attached test reproduces the issue:
- On macOS, select input source 2-Set Korean
- Run the application, type 'ㄴ' ("s" key), and type 'ㅇ' ("d" key). Note that composition mode starts. See "enter_composition_mode.png"
- Press backspace, the composition mode ends (see "remove_composition_mode.png"), but the exception is thrown.
Expected: when pressing the back key, the composition mode ends and there is no exception thrown
Observed: when pressing the back key, the composition mode ends and there is an exception thrown