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.) -- Summary: Swing JTextField fails with StringIndexOutOfBoundsException Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: AWT AssignedTo: fitzsim at redhat dot com ReportedBy: hendrich at informatik dot uni-hamburg dot de CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19862