Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6210674
Votes 4
Synopsis FileChooser fails to load custom harddrive icon and gets NullPointerException
Category java:classes_swing
Reported Against
Release Fixed 7(b27)
State 10-Fix Delivered, bug
Priority: 3-Medium
Related Bugs 6574983
Submit Date 20-DEC-2004
Description
FULL PRODUCT VERSION :
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
 customer  Windows 2000 [Version 5.00.2195]

EXTRA RELEVANT SYSTEM CONFIGURATION :
Maxtor E14G300 300Gb 7200rpm Onetouch II 16Mb External USB2.0/Firewire

A DESCRIPTION OF THE PROBLEM :
I own an external firewire harddrive that  use a custom icon. When I create a JFileChooser using the Windows system L&F I get a NullPointerException.

Note, code below will return the correct icon so there is a bug in the file chooser code.

FileSystemView fsv = FileSystemView.getFileSystemView();
fsv.getSystemIcon(new File("i:/"));


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a java application, set the L&F to system, create a JFileChooser. Prerequisits is of course a external harddrive with custom icon...


ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.NullPointerException
        at javax.swing.ImageIcon.<init>(Unknown Source)
        at javax.swing.ImageIcon.<init>(Unknown Source)
        at sun.swing.WindowsPlacesBar.<init>(Unknown Source)
        at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.updateUseShellFolder(Unknown Source)

        at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installComponents(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 Test.main(Test.java:12)

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.*;

public class Test
{
	public static void main(String ... args)
	{
		try
		{
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

			JFileChooser chooser = new JFileChooser();
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Do not use system L&F in windows.
  xxxxx@xxxxx   2004-12-20 17:12:59 GMT
Work Around
N/A
Evaluation
Will investigate for next release.
  xxxxx@xxxxx   2005-04-18 22:33:45 GMT
WindowsPlacesBar should use default icon for folders that doesn't have own icon
Posted Date : 2008-04-29 09:42:24.0
Comments
  
  Include a link with my name & email   

Submitted On 15-FEB-2007
francisdb
A friend of mine had the same bug with 1.6 on win xp

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
       at javax.swing.ImageIcon.<init>(Unknown Source)
       at javax.swing.ImageIcon.<init>(Unknown Source)
       at sun.swing.WindowsPlacesBar.<init>(Unknown Source)
       at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.updateUseShellFolder(Unknown Source)
       at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installComponents(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 javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
       at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
       at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
       at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
       at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
       at java.awt.Component.processMouseEvent(Unknown Source)
       at javax.swing.JComponent.processMouseEvent(Unknown Source)
       at java.awt.Component.processEvent(Unknown Source)
       at java.awt.Container.processEvent(Unknown Source)
       at java.awt.Component.dispatchEventImpl(Unknown Source)
       at java.awt.Container.dispatchEventImpl(Unknown Source)
       at java.awt.Component.dispatchEvent(Unknown Source)
       at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
       at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
       at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
       at java.awt.Container.dispatchEventImpl(Unknown Source)
       at java.awt


Submitted On 19-FEB-2007
Anybody using Netbeans please follow the link below to learn more about the problem and possible workaround. As mentioned above in the 'Customer Submitted Workaround' section the trick is not to use Windows L&F.

http://www.netbeans.org/issues/show_bug.cgi?id=95147

Thanks,
-vita


Submitted On 28-FEB-2008
tomoke
There appears to be a workaround which is a bit more elegant than telling the user to not use the L&F, this is taken from the LimeWire GUI patch: https://www.limewire.org/jira/browse/LWC-370

Essentially, one tests for the situation, and if it is occuring on your system, you switch the look and feel for the chooser to Metal, not the whole app.


Submitted On 07-APR-2009
moey0601
We have a user which is using our software PersonalBrain and his log file indicates the same problem as described above.  Below is the full contents of the stack trace.  Can this bug be re-opened? 

PRODUCT VERSION:
Java 1.6.0_13

ADDITIONAL OS INFORMATION:
Operating system: Windows XP

Stack Trace listed below:
Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException
	at javax.swing.ImageIcon.<init>(Unknown Source)
	at javax.swing.ImageIcon.<init>(Unknown Source)
	at sun.swing.WindowsPlacesBar.<init>(Unknown Source)
	at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.updateUseShellFolder(Unknown Source)
	at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installComponents(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.thebrain.personal.c.a.a(OSHelper.java:507)
	at com.thebrain.personal.c.a.do(OSHelper.java:494)
	at com.thebrain.personal.view.h.if(MainFrame.java:1305)
	at com.thebrain.personal.view.h.try(MainFrame.java:1277)
	at com.thebrain.personal.view.b.h.a(BrainAction.java:1077)
	at com.thebrain.personal.view.b.h.actionPerformed(BrainAction.java:392)
	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at javax.swing.AbstractButton.doClick(Unknown Source)
	at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
	at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
	at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at com.thebrain.personal.f.u.dispatchEvent(TextContextMenuEventQueue.java:15)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(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)



Submitted On 07-APR-2009
moey0601
We have a user which is using our software PersonalBrain and his log file indicates the same problem as described above.  Below is the full contents of the stack trace.  Can this bug be re-opened? 

PRODUCT VERSION:
Java 1.6.0_13

ADDITIONAL OS INFORMATION:
Operating system: Windows XP

Stack Trace listed below:
Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException
	at javax.swing.ImageIcon.<init>(Unknown Source)
	at javax.swing.ImageIcon.<init>(Unknown Source)
	at sun.swing.WindowsPlacesBar.<init>(Unknown Source)
	at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.updateUseShellFolder(Unknown Source)
	at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installComponents(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.thebrain.personal.c.a.a(OSHelper.java:507)
	at com.thebrain.personal.c.a.do(OSHelper.java:494)
	at com.thebrain.personal.view.h.if(MainFrame.java:1305)
	at com.thebrain.personal.view.h.try(MainFrame.java:1277)
	at com.thebrain.personal.view.b.h.a(BrainAction.java:1077)
	at com.thebrain.personal.view.b.h.actionPerformed(BrainAction.java:392)
	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at javax.swing.AbstractButton.doClick(Unknown Source)
	at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
	at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
	at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at com.thebrain.personal.f.u.dispatchEvent(TextContextMenuEventQueue.java:15)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(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)



Submitted On 17-SEP-2009
cpesch
The patch as suggested by https://www.limewire.org/jira/browse/LWC-370 works fine for my http://www.routeconverter.de/ application.



PLEASE NOTE: JDK6 is formerly known as Project Mustang