JDK-6637885 : Enabling High Contrast Mode breaks all running Java applications
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6u5
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_vista
  • CPU: x86
  • Submitted: 2007-12-05
  • Updated: 2011-02-16
  • Resolved: 2010-06-24
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.6.0_10-ea"
Java(TM) SE Runtime Environment (build 1.6.0_10-ea-b07)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_10-ea-b07, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Vista 64-bit
Microsoft Windows [Version 6.0.6000]

A DESCRIPTION OF THE PROBLEM :
I believe this bug report is identical to 6588271, 6622760 and 6629522 though it is the first one to provide a testcase that is 100% reproducible. I consider this bug to be quite severe as it takes down the Java application once triggered (i.e. the application must be restarted).

1) Run SwingSet2
2) Change to Windows L&F
3) Hit ALT + left SHIFT + PRINT SCREEN (this will enable "High Contrast Mode"
4) SwingSet2 will throw the following exception:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at com.sun.java.swing.plaf.windows.XPStyle$Skin.getWidth(XPStyle.java:513)
        at com.sun.java.swing.plaf.windows.XPStyle$Skin.getWidth(XPStyle.java:517)
        at com.sun.java.swing.plaf.windows.WindowsIconFactory$VistaMenuItemCheckIconFactory.getIconWidth(WindowsIconFactory.java:668)
        at com.sun.java.swing.plaf.windows.WindowsLookAndFeel$1.createValue(WindowsLookAndFeel.java:1768)
        at com.sun.java.swing.plaf.windows.WindowsLookAndFeel$XPValue.recursiveCreateValue(WindowsLookAndFeel.java:2449)
        at com.sun.java.swing.plaf.windows.WindowsLookAndFeel$XPValue.getXPValue(WindowsLookAndFeel.java:2437)
        at com.sun.java.swing.plaf.windows.WindowsLookAndFeel$XPValue.createValue(WindowsLookAndFeel.java:2424)
        at javax.swing.UIDefaults.getFromHashtable(UIDefaults.java:214)
        at javax.swing.UIDefaults.get(UIDefaults.java:144)
        at javax.swing.MultiUIDefaults.get(MultiUIDefaults.java:44)
        at javax.swing.UIManager.get(UIManager.java:954)
        at javax.swing.plaf.basic.BasicMenuItemUI.layoutMenuItem(BasicMenuItemUI.java:932)
        at javax.swing.plaf.basic.BasicMenuItemUI.getPreferredMenuItemSize(BasicMenuItemUI.java:455)
        at com.sun.java.swing.plaf.windows.WindowsMenuUI.getPreferredMenuItemSize(WindowsMenuUI.java:263)
        at javax.swing.plaf.basic.BasicMenuItemUI.getPreferredSize(BasicMenuItemUI.java:360)
        at javax.swing.JComponent.getPreferredSize(JComponent.java:1632)
        at javax.swing.BoxLayout.checkRequests(BoxLayout.java:464)
        at javax.swing.BoxLayout.layoutContainer(BoxLayout.java:405)
        at java.awt.Container.layout(Container.java:1432)
        at java.awt.Container.doLayout(Container.java:1421)
        at java.awt.Container.validateTree(Container.java:1519)
        at java.awt.Container.validateTree(Container.java:1526)
        at java.awt.Container.validateTree(Container.java:1526)
        at java.awt.Container.validateTree(Container.java:1526)
        at java.awt.Container.validate(Container.java:1491)
        at java.awt.Window.dispatchEventImpl(Window.java:2438)
        at java.awt.Component.dispatchEvent(Component.java:4302)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)


REPRODUCIBILITY :
This bug can be reproduced always.

Comments
EVALUATION This bug is not reproducible on WindowsXP; Judging by the provided stack trace the problem is in the Vista LookAndFeel So we should fix it to not throw the exception
07-12-2007