-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
6u16
-
x86
-
linux_ubuntu
FULL PRODUCT VERSION :
java version "1.6.0_16"
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
Java HotSpot(TM) Server VM (build 14.2-b01, mixed mo
ADDITIONAL OS VERSION INFORMATION :
Linux developer-machine 2.6.28-15-server #52-Ubuntu SMP Wed Sep 9 11:50:50 UTC 2009 i686 GNU/Linux
EXTRA RELEVANT SYSTEM CONFIGURATION :
This nis not limited to Ubuntu/Linux. This happens on Windows XP also. This was found when upgrading to JDK1.6_16 all environments
A DESCRIPTION OF THE PROBLEM :
If a text field's text length > 2 and text is deleted from a range > 0 and less than < field.getText().length() - 2 an ArrayIndexOutOfBoundsException will be thrown if use selects text by using mouse drag.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run test case. Delete the number 2 from the text field . Select text by dragging mouse. An exception should be thrown.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Text should be selected and no exception should be thrown.
ACTUAL -
Exception thrown.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 2
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:6311)
at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3285)
at java.awt.Component.processEvent(Component.java:6032)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
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:4460)
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)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
public class TextBoxTest {
public static void main(String[] args) throws Exception {
SwingUtilities.invokeLater(
new Runnable() {
public void run() {
final JFrame frame = new JFrame();
frame.add(new JTextField("123"));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
}
);
}
}
---------- END SOURCE ----------
java version "1.6.0_16"
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
Java HotSpot(TM) Server VM (build 14.2-b01, mixed mo
ADDITIONAL OS VERSION INFORMATION :
Linux developer-machine 2.6.28-15-server #52-Ubuntu SMP Wed Sep 9 11:50:50 UTC 2009 i686 GNU/Linux
EXTRA RELEVANT SYSTEM CONFIGURATION :
This nis not limited to Ubuntu/Linux. This happens on Windows XP also. This was found when upgrading to JDK1.6_16 all environments
A DESCRIPTION OF THE PROBLEM :
If a text field's text length > 2 and text is deleted from a range > 0 and less than < field.getText().length() - 2 an ArrayIndexOutOfBoundsException will be thrown if use selects text by using mouse drag.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run test case. Delete the number 2 from the text field . Select text by dragging mouse. An exception should be thrown.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Text should be selected and no exception should be thrown.
ACTUAL -
Exception thrown.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 2
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:6311)
at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3285)
at java.awt.Component.processEvent(Component.java:6032)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
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:4460)
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)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
public class TextBoxTest {
public static void main(String[] args) throws Exception {
SwingUtilities.invokeLater(
new Runnable() {
public void run() {
final JFrame frame = new JFrame();
frame.add(new JTextField("123"));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
}
);
}
}
---------- END SOURCE ----------