Bug #2972
Bug #2677: fix drawing and functional differences between P2J GUI and 4GL GUI
StringIndexOutOfBoundsException in ScrollBar (GUI)
0%
History
#1 Updated by Vadim Gindin over 8 years ago
To recreate the error any EDITOR with horizontal scroll bars is enough. For example, uast/gui_editor_popup.p
The first case is simplest.¶
The user just types any characters one by one for example "11111111111111...". When the text will exceed the width of EDITOR and horizontal scroll bar will be activated, the user continues typing and after some moment an exception will be thrown:
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 52 at java.lang.String.substring(String.java:1951) at com.goldencode.p2j.ui.client.gui.EditorGuiImpl.computeHorizontalDelta(EditorGuiImpl.java:2425) at com.goldencode.p2j.ui.client.gui.EditorGuiImpl.access$4(EditorGuiImpl.java:2421) at com.goldencode.p2j.ui.client.gui.EditorGuiImpl$EditorContent.draw(EditorGuiImpl.java:2655) at com.goldencode.p2j.ui.client.widget.AbstractContainer.draw(AbstractContainer.java:412) at com.goldencode.p2j.ui.client.gui.BorderedPanelGuiImpl.access$4(BorderedPanelGuiImpl.java:1) ..bzr
The second case.¶
When the number of characters in a single line is equal to editor character width and the user has typed another one characters: PROGRESS sometimes makes a "shift": extending "line buffer" to several characters at a time. If the user continue typing in this line it happens as usual, but P2J makes that "shift" each next typed character (1). If the user continues typing, than after several consistent shifts it will get the same exception (2). I.e. there are 2 errors: exception and the logic of shift.