|
Description
|
Whilst running the test case from bug 6560196 on JDK 7 b12 I obtained the
following exception :
Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: range length: -2
at java.awt.Font.getStringBounds(Font.java:2243)
at sun.swing.SwingUtilities2.drawChars(SwingUtilities2.java:793)
at javax.swing.text.Utilities.drawTabbedText(Utilities.java:188)
at javax.swing.text.GlyphPainter1.paint(GlyphPainter1.java:120)
at javax.swing.text.GlyphView.paintTextUsingColor(GlyphView.java:490)
at javax.swing.text.GlyphView.paint(GlyphView.java:481)
at javax.swing.text.BoxView.paintChild(BoxView.java:162)
at javax.swing.text.BoxView.paint(BoxView.java:434)
...
I traced this back to the b08 fix for 6488219, and specifically this :
> getStringBounds(data, offset, length, frc).getWidth();
the problem is that the third argument should be "limit" not "length"
So long as offset is zero, this isn't a problem, but in some cases
Swing text will index into an array and expose this bug.
Also the code path in which this shows up is only used when printing.
Posted Date : 2007-05-22 18:53:10.0
|