JDK-6883341 : SWAT: jdk7-b72 swat build(2009-09-17) threw exceptions when running Java2D demo by clicking Paint ta
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 7
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2009-09-17
  • Updated: 2011-01-19
  • Resolved: 2009-10-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7
6u21Resolved 7 b74Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
Java Version: 
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b72)
Java HotSpot(TM) Client VM (build 17.0-b01, mixed mode)

Platforms: WindowsXPpro, Solaris-sparc10

Problems:
I launch the Java2Demo within b72, when I clcik Paint tab, it threw exceptions as followings, that only happens in b72-2009-09-17 build, but b72's previous builds are fine, meaning b72-2009--09-16 and previous are OK, so looks like there is a regression in b72-2009-09-17 build.

To reproduce the problem:
1, Go to RE site to launch the Java2Demo by using the b72-2009-09-17 runtime
2, Click Paint, you will see the following exceptions. 

Z:\jdk7\binaries\windows-i586\b72-2009-09-17\jdk1.7.0>bin\java -jar demo\jfc\Java2D\*.jar

Exception in thread "AWT-EventQueue-0" java.lang.StringIndexOutOfBoundsException
: String index out of range: 0
        at java.lang.String.charAt(String.java:694)
        at sun.swing.SwingUtilities2.getLeftSideBearing(SwingUtilities2.java:248
)
        at sun.swing.MenuItemLayoutHelper.getLeftExtraWidth(MenuItemLayoutHelper
.java:162)
        at sun.swing.MenuItemLayoutHelper.calcExtraWidths(MenuItemLayoutHelper.j
ava:158)
        at sun.swing.MenuItemLayoutHelper.reset(MenuItemLayoutHelper.java:148)
        at sun.swing.MenuItemLayoutHelper.<init>(MenuItemLayoutHelper.java:107)
        at javax.swing.plaf.basic.BasicMenuItemUI.getPreferredMenuItemSize(Basic
MenuItemUI.java:408)
        at javax.swing.plaf.basic.BasicMenuItemUI.getPreferredSize(BasicMenuItem
UI.java:363)
        at javax.swing.JComponent.getPreferredSize(JComponent.java:1650)
        at javax.swing.BoxLayout.checkRequests(BoxLayout.java:483)
        at javax.swing.BoxLayout.preferredLayoutSize(BoxLayout.java:300)
        at javax.swing.plaf.basic.DefaultMenuLayout.preferredLayoutSize(DefaultM
enuLayout.java:60)
        at java.awt.Container.preferredSize(Container.java:1644)
        at java.awt.Container.getPreferredSize(Container.java:1629)
        at javax.swing.JComponent.getPreferredSize(JComponent.java:1652)
        at java.awt.FlowLayout.layoutContainer(FlowLayout.java:609)
        at java.awt.Container.layout(Container.java:1465)
        at java.awt.Container.doLayout(Container.java:1454)
        at java.awt.Container.validateTree(Container.java:1552)
        at java.awt.Container.validateTree(Container.java:1558)
        at java.awt.Container.validateTree(Container.java:1558)
        at java.awt.Container.validateTree(Container.java:1558)
        at java.awt.Container.validateTree(Container.java:1558)
        at java.awt.Container.validateTree(Container.java:1558)
        at java.awt.Container.validateTree(Container.java:1558)
        at java.awt.Container.validateTree(Container.java:1558)
        at java.awt.Container.validateTree(Container.java:1558)
        at java.awt.Container.validateTree(Container.java:1558)
        at java.awt.Container.validate(Container.java:1524)
        at javax.swing.RepaintManager.validateInvalidComponents(RepaintManager.j
ava:687)
        at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java
:1654)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:235)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:616)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThre
ad.java:286)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.
java:201)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:191)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:186)

        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:178)

        at java.awt.EventDispatchThread.run(EventDispatchThread.java:139)
Exception in thread "AWT-EventQueue-0" java.lang.StringIndexOutOfBoundsException
: String index out of range: 0
        at java.lang.String.charAt(String.java:694)
        at sun.swing.SwingUtilities2.getLeftSideBearing(SwingUtilities2.java:248
)
        at sun.swing.MenuItemLayoutHelper.getLeftExtraWidth(MenuItemLayoutHelper
.java:162)
        at sun.swing.MenuItemLayoutHelper.calcExtraWidths(MenuItemLayoutHelper.j
ava:158)
        at sun.swing.MenuItemLayoutHelper.reset(MenuItemLayoutHelper.java:148)
        at sun.swing.MenuItemLayoutHelper.<init>(MenuItemLayoutHelper.java:107)
        at javax.swing.plaf.basic.BasicMenuItemUI.getPreferredMenuItemSize(Basic
MenuItemUI.java:408)
        at javax.swing.plaf.basic.BasicMenuItemUI.getPreferredSize(BasicMenuItem
UI.java:363)
        at javax.swing.JComponent.getPreferredSize(JComponent.java:1650)
        at javax.swing.BoxLayout.checkRequests(BoxLayout.java:483)
        at javax.swing.BoxLayout.preferredLayoutSize(BoxLayout.java:300)
        at javax.swing.plaf.basic.DefaultMenuLayout.preferredLayoutSize(DefaultM
enuLayout.java:60)
        at java.awt.Container.preferredSize(Container.java:1644)
        at java.awt.Container.getPreferredSize(Container.java:1629)
        at javax.swing.JComponent.getPreferredSize(JComponent.java:1652)
        at java.awt.FlowLayout.layoutContainer(FlowLayout.java:609)
        at java.awt.Container.layout(Container.java:1465)
        at java.awt.Container.doLayout(Container.java:1454)
        at java.awt.Container.validateTree(Container.java:1552)
        at java.awt.Container.validateTree(Container.java:1558)
        at java.awt.Container.validateTree(Container.java:1558)
        at java.awt.Container.validateTree(Container.java:1558)
        at java.awt.Container.validateTree(Container.java:1558)
        at java.awt.Container.validateTree(Container.java:1558)
        at java.awt.Container.validate(Container.java:1524)
        at javax.swing.plaf.basic.BasicTabbedPaneUI.ensureCurrentLayout(BasicTab
bedPaneUI.java:1446)
        at javax.swing.plaf.basic.BasicTabbedPaneUI.paint(BasicTabbedPaneUI.java
:787)
        at javax.swing.plaf.metal.MetalTabbedPaneUI.paint(MetalTabbedPaneUI.java
:843)
        at javax.swing.plaf.metal.MetalTabbedPaneUI.update(MetalTabbedPaneUI.jav
a:724)
        at javax.swing.JComponent.paintComponent(JComponent.java:778)
        at javax.swing.JComponent.paint(JComponent.java:1044)
        at javax.swing.JComponent.paintChildren(JComponent.java:879)
        at javax.swing.JComponent.paint(JComponent.java:1053)
        at javax.swing.JComponent.paintToOffscreen(JComponent.java:5182)
        at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManag
er.java:295)
        at javax.swing.RepaintManager.paint(RepaintManager.java:1240)
        at javax.swing.JComponent._paintImmediately(JComponent.java:5130)
        at javax.swing.JComponent.paintImmediately(JComponent.java:4940)
        at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:804)

        at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:762)

        at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:7
11)
        at javax.swing.RepaintManager.access$700(RepaintManager.java:59)
        at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java
:1655)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:235)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:616)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThre
ad.java:286)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.
java:201)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:191)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:186)

        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:178)

        at java.awt.EventDispatchThread.run(EventDispatchThread.java:139)

Comments
EVALUATION SwingUtilities.getLeftSideBearing(JComponent, FontMetrics, String) throws an exception for empty strings
18-09-2009