JDK-6501208 : Vista:FileChooserDemo throws an exception when trying to open it in Windows L&F
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_vista
  • CPU: x86
  • Submitted: 2006-12-06
  • Updated: 2011-02-16
  • Resolved: 2006-12-06
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
Java 1.5.0_09

ADDITIONAL OS VERSION INFORMATION :
Windows Vista RC2, build 5744

A DESCRIPTION OF THE PROBLEM :
Constructing a JFileChooser throws an exception when using the Windows look and feel.

This is the stack trace our code generated:

java.lang.ArrayIndexOutOfBoundsException: 3184
	at sun.awt.shell.Win32ShellFolder2.getFileChooserIcon(Unknown Source)
	at sun.awt.shell.Win32ShellFolderManager2.get(Unknown Source)
	at sun.awt.shell.ShellFolder.get(Unknown Source)
	at com.sun.java.swing.plaf.windows.WindowsLookAndFeel$LazyWindowsIcon.createValue(Unknown Source)
	at javax.swing.UIDefaults.getFromHashtable(Unknown Source)
	at javax.swing.UIDefaults.get(Unknown Source)
	at javax.swing.MultiUIDefaults.get(Unknown Source)
	at javax.swing.UIDefaults.getIcon(Unknown Source)
	at javax.swing.UIManager.getIcon(Unknown Source)
	at javax.swing.plaf.basic.BasicFileChooserUI.installIcons(Unknown Source)
	at javax.swing.plaf.basic.BasicFileChooserUI.installDefaults(Unknown Source)
	at javax.swing.plaf.basic.BasicFileChooserUI.installUI(Unknown Source)
	at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installUI(Unknown Source)
	at javax.swing.JComponent.setUI(Unknown Source)
	at javax.swing.JFileChooser.updateUI(Unknown Source)
	at javax.swing.JFileChooser.setup(Unknown Source)
	at javax.swing.JFileChooser.<init>(Unknown Source)
	at javax.swing.JFileChooser.<init>(Unknown Source)
	at com.t4l.io.MiscIO$1.run(MiscIO.java:1312)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

This appears to the same as bug 6449933, but that bug is closed for Mustang.  We are interested in a solution/work-around for Java 1.5.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Using the sample code provided in bug 6449933, we reproduced this problem.  This code is provided below.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A JFileChooser should be constructed and displayed.
ACTUAL -
An exception prevented the JFileChooser from being constructed.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: 3184

	at com.t4l.test.TestChooser$1.run(TestChooser.java:23)

	at java.awt.event.InvocationEvent.dispatch(Unknown Source)

	at java.awt.EventQueue.dispatchEvent(Unknown Source)

	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)

	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

	at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 3184
	at sun.awt.shell.Win32ShellFolder2.getFileChooserIcon(Unknown Source)
	at sun.awt.shell.Win32ShellFolderManager2.get(Unknown Source)
	at sun.awt.shell.ShellFolder.get(Unknown Source)
	at com.sun.java.swing.plaf.windows.WindowsLookAndFeel$LazyWindowsIcon.createValue(Unknown Source)
	at javax.swing.UIDefaults.getFromHashtable(Unknown Source)
	at javax.swing.UIDefaults.get(Unknown Source)
	at javax.swing.MultiUIDefaults.get(Unknown Source)
	at javax.swing.UIDefaults.getIcon(Unknown Source)
	at javax.swing.UIManager.getIcon(Unknown Source)
	at javax.swing.plaf.basic.BasicFileChooserUI.installIcons(Unknown Source)
	at javax.swing.plaf.basic.BasicFileChooserUI.installDefaults(Unknown Source)
	at javax.swing.plaf.basic.BasicFileChooserUI.installUI(Unknown Source)
	at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installUI(Unknown Source)
	at javax.swing.JComponent.setUI(Unknown Source)
	at javax.swing.JFileChooser.updateUI(Unknown Source)
	at javax.swing.JFileChooser.setup(Unknown Source)
	at javax.swing.JFileChooser.<init>(Unknown Source)
	at javax.swing.JFileChooser.<init>(Unknown Source)
	at com.t4l.test.TestChooser$1.run(TestChooser.java:20)
	... 7 more



REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------

import javax.swing.JFileChooser;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;

public class TestChooser {
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				try {
					UIManager.setLookAndFeel(new WindowsLookAndFeel());
					JFileChooser chooser = new JFileChooser();
					chooser.showOpenDialog(null);
				} catch (Exception e) {
					throw new RuntimeException(e);
				}
			}
		});
	}
}
---------- END SOURCE ----------

Comments
EVALUATION Duplicate of 6449933.
06-12-2006