Index: javax/swing/text/GapContent.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/text/GapContent.java,v retrieving revision 1.21 diff -u -r1.21 GapContent.java --- javax/swing/text/GapContent.java 12 Aug 2005 15:33:03 -0000 1.21 +++ javax/swing/text/GapContent.java 25 Aug 2005 19:17:47 -0000 @@ -274,8 +274,23 @@ public String getString(int where, int len) throws BadLocationException { Segment seg = new Segment(); - getChars(where, len, seg); - return new String(seg.array, seg.offset, seg.count); + try + { + getChars(where, len, seg); + return new String(seg.array, seg.offset, seg.count); + } + catch (StringIndexOutOfBoundsException ex) + { + int invalid = 0; + if (seg.offset < 0 || seg.offset >= seg.array.length) + invalid = seg.offset; + else + invalid = seg.offset + seg.count; + throw new BadLocationException("Illegal location: array.length = " + + seg.array.length + ", offset = " + + seg.offset + ", count = " + + seg.count, invalid); + } } /**