Skip to main content

6u14ea IndexOutOfBounds exception in BasicTextUI

1 reply [Last post]
Joined: 2007-04-17
Points: 0

Not sure if I should submit this in the bug parade as it has no option for 6u14ea (only Java SE 7 ea).

To reproduce:
-Run the program below
-start typing text in the text field
-while typing, keep drag-selecting text from the right to the left (selected text gets replaced by what you type)
-you should get the exception below.

I cannot reproduce this on 6u12.

import java.awt.EventQueue;</p>
<p>import javax.swing.JFrame;<br />
import javax.swing.JTextField;</p>
<p>public class TestDragCaret {<br />
    public static void main(String[] args) {<br />
        EventQueue.invokeLater(new Runnable() {<br />
            public void run() {<br />
                JFrame frame = new JFrame("Test drag caret");<br />
                frame.getContentPane().add(new JTextField(40));<br />
                frame.pack();<br />
                frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);<br />
                frame.setLocationRelativeTo(null);<br />
                frame.setVisible(true);<br />
            }<br />
        });<br />
    }<br />
}<br />

-Windows XP sp3
java version "1.6.0_14-ea"
Java(TM) SE Runtime Environment (build 1.6.0_14-ea-b04)
Java HotSpot(TM) Client VM (build 14.0-b13, mixed mode, sharing)

Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 8
at sun.font.FontDesignMetrics.charsWidth(
at javax.swing.text.Utilities.getTabbedTextOffset(
at javax.swing.text.Utilities.getTabbedTextOffset(
at javax.swing.text.Utilities.getTabbedTextOffset(
at javax.swing.text.PlainView.viewToModel(
at javax.swing.text.FieldView.viewToModel(
at javax.swing.plaf.basic.BasicTextUI$RootView.viewToModel(
at javax.swing.plaf.basic.BasicTextUI.viewToModel(
at javax.swing.text.DefaultCaret.moveCaret(
at javax.swing.text.DefaultCaret.mouseDragged(
at java.awt.AWTEventMulticaster.mouseDragged(
at java.awt.Component.processMouseMotionEvent(
at javax.swing.JComponent.processMouseMotionEvent(
at java.awt.Component.processEvent(
at java.awt.Container.processEvent(
at java.awt.Component.dispatchEventImpl(
at java.awt.Container.dispatchEventImpl(
at java.awt.Component.dispatchEvent(
at java.awt.LightweightDispatcher.retargetMouseEvent(
at java.awt.LightweightDispatcher.processMouseEvent(
at java.awt.LightweightDispatcher.dispatchEvent(
at java.awt.Container.dispatchEventImpl(
at java.awt.Window.dispatchEventImpl(
at java.awt.Component.dispatchEvent(
at java.awt.EventQueue.dispatchEvent(
at java.awt.EventDispatchThread.pumpOneEventForFilters(
at java.awt.EventDispatchThread.pumpEventsForFilter(
at java.awt.EventDispatchThread.pumpEventsForHierarchy(
at java.awt.EventDispatchThread.pumpEvents(
at java.awt.EventDispatchThread.pumpEvents(

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2004-11-17
Points: 0

A new regression bug(6828938) has been filed. keep you posted on any status update.