Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6828938

REGRESSION:IndexOutOfBounds exception throws in BasicTextUI

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 6u14
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • Introduced In Build:
      b04
    • Introduced In Version:
    • CPU:
      x86
    • OS:
      windows_xp

      Description

      Regression issue reported from 6uN EA forum:

      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.

      Cannot reproduce this on 6u12.

      [code]

      import java.awt.EventQueue;
      import javax.swing.JFrame;
      import javax.swing.JTextField;

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

      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)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                gsm Sergey Groznyh (Inactive)
                Reporter:
                tyao Ting-Yun Ingrid Yao (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: