The following test fails with
java.lang.IndexOutOfBoundsException: index=3
at jfx.incubator.richtext/jfx.incubator.scene.control.richtext.RichTextArea.getPlainText(RichTextArea.java:1494)
at jfx.incubator.richtext/jfx.incubator.scene.control.richtext.RichTextArea.getText(RichTextArea.java:1552)
at jfx.incubator.richtext/jfx.incubator.scene.control.richtext.RichTextArea$1.getText(RichTextArea.java:322)
at jfx.incubator.richtext/com.sun.jfx.incubator.scene.control.richtext.RichTextAreaHelper.getText(RichTextAreaHelper.java:59)
at jfx.incubator.richtext/test.jfx.incubator.scene.control.richtext.CodeAreaTest.selectAll(CodeAreaTest.java:327)
at java.base/java.lang.reflect.Method.invoke(Method.java:565)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1604)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1604)
```
@Test
public void selectAll() {
String text =
"""
Hello, Javafx1
Hello, Javafx2
""";
control.setText(text);
assertEquals(3, control.getParagraphCount());
control.selectAll();
SelectionSegment sel = control.getSelection();
StringBuilder sb = new StringBuilder();
RichTextAreaHelper.getText(control, sel.getMin(), sel.getMax(), sb, Integer.MAX_VALUE);
assertEquals(text, sb.toString());
}
```
The same issue is present in RichTextArea.
Thanks to https://github.com/oyzh1994 for discovering the bug and providing a test case: https://github.com/andy-goryachev-oracle/Test/issues/6#issuecomment-3726867016
java.lang.IndexOutOfBoundsException: index=3
at jfx.incubator.richtext/jfx.incubator.scene.control.richtext.RichTextArea.getPlainText(RichTextArea.java:1494)
at jfx.incubator.richtext/jfx.incubator.scene.control.richtext.RichTextArea.getText(RichTextArea.java:1552)
at jfx.incubator.richtext/jfx.incubator.scene.control.richtext.RichTextArea$1.getText(RichTextArea.java:322)
at jfx.incubator.richtext/com.sun.jfx.incubator.scene.control.richtext.RichTextAreaHelper.getText(RichTextAreaHelper.java:59)
at jfx.incubator.richtext/test.jfx.incubator.scene.control.richtext.CodeAreaTest.selectAll(CodeAreaTest.java:327)
at java.base/java.lang.reflect.Method.invoke(Method.java:565)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1604)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1604)
```
@Test
public void selectAll() {
String text =
"""
Hello, Javafx1
Hello, Javafx2
""";
control.setText(text);
assertEquals(3, control.getParagraphCount());
control.selectAll();
SelectionSegment sel = control.getSelection();
StringBuilder sb = new StringBuilder();
RichTextAreaHelper.getText(control, sel.getMin(), sel.getMax(), sb, Integer.MAX_VALUE);
assertEquals(text, sb.toString());
}
```
The same issue is present in RichTextArea.
Thanks to https://github.com/oyzh1994 for discovering the bug and providing a test case: https://github.com/andy-goryachev-oracle/Test/issues/6#issuecomment-3726867016
- caused by
-
JDK-8368478 RichTextArea: add IME support
-
- Resolved
-
- relates to
-
JDK-8351982 ☂ RichTextArea (Incubator) Feedback and Bugs in jfx24
-
- Open
-
- links to
-
Review(master)
openjdk/jfx/2029