JDK-6973685 : JFileChooser throws NullPointerException
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6u21
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • OS: windows_7
  • CPU: x86
  • Submitted: 2010-07-31
  • Updated: 2024-01-02
  • Resolved: 2019-12-17
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
The problem occurs in the latest Sun JRE 5.0, Sun JRE 6.0 and even in JRockit  1.6.0_20-b02

ADDITIONAL OS VERSION INFORMATION :
Windows 7 Home, Russian version

A DESCRIPTION OF THE PROBLEM :
javax.swing.JFileChooser no-arg constructor  throws NullPointerException:

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create the simplest Java Application and try to create JFileChooser.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
New file chooser is created and the program is successfully terminated
ACTUAL -
The java.lang.NullPointerException is thrown

ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "Main Thread" java.lang.NullPointerException
	at sun.awt.shell.Win32ShellFolder2$7.call(Win32ShellFolder2.java:550)
	at sun.awt.shell.Win32ShellFolder2$7.call(Win32ShellFolder2.java:547)
	at sun.awt.shell.Win32ShellFolderManager2$ComInvoker.invoke(Win32ShellFolderManager2.java:518)
	at sun.awt.shell.ShellFolder.invoke(ShellFolder.java:399)
	at sun.awt.shell.ShellFolder.invoke(ShellFolder.java:385)
	at sun.awt.shell.Win32ShellFolder2.getFileSystemPath(Win32ShellFolder2.java:547)
	at sun.awt.shell.Win32ShellFolder2.access$300(Win32ShellFolder2.java:55)
	at sun.awt.shell.Win32ShellFolder2$11.call(Win32ShellFolder2.java:727)
	at sun.awt.shell.Win32ShellFolder2$11.call(Win32ShellFolder2.java:718)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at sun.awt.shell.Win32ShellFolderManager2$ComInvoker$3.run(Win32ShellFolderManager2.java:487)
	at java.lang.Thread.run(Thread.java:619)

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
package com;

import javax.swing.*;

public class EntryPoint {
    public static void main(String[] args) throws Exception {
        new JFileChooser();
    }
}
---------- END SOURCE ----------

SUPPORT :
YES

Comments
JDK-8190514 reports the same bug.
02-01-2024

Starter bugs
23-05-2017