-
Bug
-
Resolution: Cannot Reproduce
-
P3
-
None
-
1.4.2, 5.0u6, 6
-
generic, x86
-
generic, windows_2000
Name: rmT116609 Date: 06/04/2003
FULL PRODUCT VERSION :
java version "1.4.2-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b19)
Java HotSpot(TM) Client VM (build 1.4.2-beta-b19, mixed mode)
FULL OS VERSION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
JTabbedPane throws ArrayIndexOutOfBoundsException sometimes.
When using SCROLL_TAB_LAYOUT ArrayIndexOutOfBoundsException sometimes gets thrown from BasicTabbedPaneUI$ScrollableTabSupport.stateChanged(...)
As producing a small test case is very difficult here is some debug info that might help find the problem.
The problem only happens when protected void assureRectsCreated(int tabCount) is called with tabCount == 0.
Every time the problem happens in public void stateChanged(ChangeEvent e) with tabPane.getTabCount() > 1 && leadingTabIndex == 0 and rects.length == 0 hence (rects[leadingTabIndex].x < viewRect.x) throws the ArrayIndexOutOfBoundsException .
Events are queued to do the layout add a couple of tabs to a previously empty tabbedPane then when the layout gets done it causes the viewport to be resized, then the tabs are added then the viewport resizing causes stateChange to be called, causing the problem.
A simple fix for this would be to call assureRectsCreated(int tabCount) straight after int tabCount = tabPane.getTabCount(); is called in
public void stateChanged(ChangeEvent e).
There are so many similar bugs it is hard to tell if any of them are related to this one. Bug 4379600 might be related.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Very difficult to produce a small test case due to the nature of the problem, see description
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
no exception
ACTUAL -
exception
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.ArrayIndexOutOfBoundsException: 0
at javax.swing.plaf.basic.BasicTabbedPaneUI$ScrollableTabSupport.stateChanged(BasicTabbedPaneUI.java:2893)
at javax.swing.JViewport.fireStateChanged(JViewport.java:1341)
at javax.swing.JViewport$ViewListener.componentResized(JViewport.java:1259)
at java.awt.Component.processComponentEvent(Component.java:4957)Unhandled
at java.awt.Component.processEvent(Component.java:4911)
at java.awt.Container.processEvent(Container.java:1569)
at java.awt.Component.dispatchEventImpl(Component.java:3614)
at java.awt.Container.dispatchEventImpl(Container.java:1627)
at java.awt.Component.dispatchEvent(Component.java:3476)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
REPRODUCIBILITY :
This bug can be reproduced occasionally.
---------- BEGIN SOURCE ----------
Very difficult to produce a small test case due to the nature of the problem, see description
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use WRAP_TAB_LAYOUT instead of SCROLL_TAB_LAYOUT
(Review ID: 186687)
======================================================================
FULL PRODUCT VERSION :
java version "1.4.2-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b19)
Java HotSpot(TM) Client VM (build 1.4.2-beta-b19, mixed mode)
FULL OS VERSION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
JTabbedPane throws ArrayIndexOutOfBoundsException sometimes.
When using SCROLL_TAB_LAYOUT ArrayIndexOutOfBoundsException sometimes gets thrown from BasicTabbedPaneUI$ScrollableTabSupport.stateChanged(...)
As producing a small test case is very difficult here is some debug info that might help find the problem.
The problem only happens when protected void assureRectsCreated(int tabCount) is called with tabCount == 0.
Every time the problem happens in public void stateChanged(ChangeEvent e) with tabPane.getTabCount() > 1 && leadingTabIndex == 0 and rects.length == 0 hence (rects[leadingTabIndex].x < viewRect.x) throws the ArrayIndexOutOfBoundsException .
Events are queued to do the layout add a couple of tabs to a previously empty tabbedPane then when the layout gets done it causes the viewport to be resized, then the tabs are added then the viewport resizing causes stateChange to be called, causing the problem.
A simple fix for this would be to call assureRectsCreated(int tabCount) straight after int tabCount = tabPane.getTabCount(); is called in
public void stateChanged(ChangeEvent e).
There are so many similar bugs it is hard to tell if any of them are related to this one. Bug 4379600 might be related.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Very difficult to produce a small test case due to the nature of the problem, see description
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
no exception
ACTUAL -
exception
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.ArrayIndexOutOfBoundsException: 0
at javax.swing.plaf.basic.BasicTabbedPaneUI$ScrollableTabSupport.stateChanged(BasicTabbedPaneUI.java:2893)
at javax.swing.JViewport.fireStateChanged(JViewport.java:1341)
at javax.swing.JViewport$ViewListener.componentResized(JViewport.java:1259)
at java.awt.Component.processComponentEvent(Component.java:4957)Unhandled
at java.awt.Component.processEvent(Component.java:4911)
at java.awt.Container.processEvent(Container.java:1569)
at java.awt.Component.dispatchEventImpl(Component.java:3614)
at java.awt.Container.dispatchEventImpl(Container.java:1627)
at java.awt.Component.dispatchEvent(Component.java:3476)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
REPRODUCIBILITY :
This bug can be reproduced occasionally.
---------- BEGIN SOURCE ----------
Very difficult to produce a small test case due to the nature of the problem, see description
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use WRAP_TAB_LAYOUT instead of SCROLL_TAB_LAYOUT
(Review ID: 186687)
======================================================================
- relates to
-
JDK-6943780 JTabbedPane throws ArrayIndexOutOfBoundsException sometimes
- Resolved