-
Bug
-
Resolution: Fixed
-
P3
-
8u40, 9
-
generic
-
generic
FULL PRODUCT VERSION :
java version "1.8.0_112"
Java(TM) SE Runtime Environment (build 1.8.0_112-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.112-b15, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Ubuntu 16.04 LTS (4.4.0-53-generic x86_64)
A DESCRIPTION OF THE PROBLEM :
I get the following exception when programmatically replace text (in specific order) in TextArea:
Exception in thread "JavaFX Application Thread" java.lang.StringIndexOutOfBoundsException: String index out of range: -3
at java.lang.String.substring(String.java:1967)
at javafx.scene.control.TextInputControl.updateContent(TextInputControl.java:571)
at javafx.scene.control.TextInputControl.replaceText(TextInputControl.java:548)
at com.test.Text.lambda$1(Text.java:33)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
at com.sun.glass.ui.gtk.GtkApplication.lambda$null$49(GtkApplication.java:139)
at java.lang.Thread.run(Thread.java:745)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
TextArea txt = new TextArea();
txt.replaceText(0, 0, "a");
txt.replaceText(1, 1, "b");
txt.replaceText(2, 2, "c");
txt.replaceText(3, 3, "d");
txt.replaceText(3, 4, "efg");
txt.replaceText(3, 6, "d");
txt.replaceText(0, 4, "");
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
TextArea txt = new TextArea();
txt.replaceText(0, 0, "a");
txt.deselect();
txt.selectPositionCaret(1);
txt.replaceText(1, 1, "b");
txt.deselect();
txt.selectPositionCaret(2);
txt.replaceText(2, 2, "c");
txt.deselect();
txt.selectPositionCaret(3);
txt.replaceText(3, 3, "d");
txt.deselect();
txt.selectPositionCaret(3);
txt.replaceText(3, 4, "efg");
txt.deselect();
txt.selectPositionCaret(3);
txt.replaceText(3, 6, "d");
txt.deselect();
txt.selectPositionCaret(0);
txt.replaceText(0, 4, "");
java version "1.8.0_112"
Java(TM) SE Runtime Environment (build 1.8.0_112-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.112-b15, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Ubuntu 16.04 LTS (4.4.0-53-generic x86_64)
A DESCRIPTION OF THE PROBLEM :
I get the following exception when programmatically replace text (in specific order) in TextArea:
Exception in thread "JavaFX Application Thread" java.lang.StringIndexOutOfBoundsException: String index out of range: -3
at java.lang.String.substring(String.java:1967)
at javafx.scene.control.TextInputControl.updateContent(TextInputControl.java:571)
at javafx.scene.control.TextInputControl.replaceText(TextInputControl.java:548)
at com.test.Text.lambda$1(Text.java:33)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
at com.sun.glass.ui.gtk.GtkApplication.lambda$null$49(GtkApplication.java:139)
at java.lang.Thread.run(Thread.java:745)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
TextArea txt = new TextArea();
txt.replaceText(0, 0, "a");
txt.replaceText(1, 1, "b");
txt.replaceText(2, 2, "c");
txt.replaceText(3, 3, "d");
txt.replaceText(3, 4, "efg");
txt.replaceText(3, 6, "d");
txt.replaceText(0, 4, "");
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
TextArea txt = new TextArea();
txt.replaceText(0, 0, "a");
txt.deselect();
txt.selectPositionCaret(1);
txt.replaceText(1, 1, "b");
txt.deselect();
txt.selectPositionCaret(2);
txt.replaceText(2, 2, "c");
txt.deselect();
txt.selectPositionCaret(3);
txt.replaceText(3, 3, "d");
txt.deselect();
txt.selectPositionCaret(3);
txt.replaceText(3, 4, "efg");
txt.deselect();
txt.selectPositionCaret(3);
txt.replaceText(3, 6, "d");
txt.deselect();
txt.selectPositionCaret(0);
txt.replaceText(0, 4, "");