Entering text into a JTextField fails with an StringIndexOutOfBoundsException, triggered by a problem in GapContent or AbstractDocument.getText(). Tested with gcc-4.0-20050130 snapshot and a current (2005.02.09) cvs checkout of gui-branch-20040128: java.lang.StringIndexOutOfBoundsException at java.lang.StringBuffer.substring(int, int) (/usr/lib/libgcj.so.6.0.0) at javax.swing.text.GapContent.getString(int, int) (/usr/lib/lib-javax-swing.so.0.0.0) at javax.swing.text.AbstractDocument.getText(int, int) (/usr/lib/lib-javax-swing.so.0.0.0) at javax.swing.text.FieldView.getPreferredSpan(int) (/usr/lib/lib-javax-swing.so.0.0.0) Testcase attached. Note that the calculator functionality is stripped off to make the testcase shorter. (This is slightly unfair for gcj, because the expression parser does work with gcj.)
Created attachment 8158 [details] testcase Just compile the class, then try entering an expression into the JTextField on the bottom of the main window and press <return> or press the <Execute> button. Note that the program also triggers a few other bugs; it can be tricky to tranfer the keyboard focus to the textfield in the first place....
Confirmed.
I have mostly fixed JTextArea in GNU Classpath. I think this can be close as soon as it is merged into GCJ.
Fixed. Closing.