Skip to main content

6u14ea IndexOutOfBounds exception in BasicTextUI

1 reply [Last post]
walterln
Offline
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 />

Info:
-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(FontDesignMetrics.java:492)
at javax.swing.text.Utilities.getTabbedTextOffset(Utilities.java:381)
at javax.swing.text.Utilities.getTabbedTextOffset(Utilities.java:302)
at javax.swing.text.Utilities.getTabbedTextOffset(Utilities.java:286)
at javax.swing.text.PlainView.viewToModel(PlainView.java:403)
at javax.swing.text.FieldView.viewToModel(FieldView.java:263)
at javax.swing.plaf.basic.BasicTextUI$RootView.viewToModel(BasicTextUI.java:1540)
at javax.swing.plaf.basic.BasicTextUI.viewToModel(BasicTextUI.java:1089)
at javax.swing.text.DefaultCaret.moveCaret(DefaultCaret.java:311)
at javax.swing.text.DefaultCaret.mouseDragged(DefaultCaret.java:565)
at java.awt.AWTEventMulticaster.mouseDragged(AWTEventMulticaster.java:303)
at java.awt.Component.processMouseMotionEvent(Component.java:6285)
at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3285)
at java.awt.Component.processEvent(Component.java:6006)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4604)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4434)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4255)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2475)
at java.awt.Component.dispatchEvent(Component.java:4434)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Reply viewing options

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

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