Initially the synopsis was "JFileChooser's COM thread doesn't stop if a security manager installed", I changed it to reflect the actual issue better.
Run a simple test:
======================
import javax.swing.filechooser.FileSystemView;
public class bug6570445 {
public static void main(String[] args) throws Exception {
System.setSecurityManager(new SecurityManager());
// The next line of code forces FileSystemView to request data from Win32ShellFolder2,
// what causes an exception if a security manager installed
FileSystemView.getFileSystemView().getRoots();
System.out.println("Passed.");
}
}
======================
The test throws an exception:
Exception in thread "main" java.lang.ExceptionInInitializerError
at sun.awt.shell.Win32ShellFolder2$ComTask.execute(Win32ShellFolder2.java:1228)
at sun.awt.shell.Win32ShellFolder2.getFileSystemPath(Win32ShellFolder2.java:559)
at sun.awt.shell.Win32ShellFolder2.composePathForCsidl(Win32ShellFolder2.java:213)
at sun.awt.shell.Win32ShellFolder2.<init>(Win32ShellFolder2.java:226)
at sun.awt.shell.Win32ShellFolderManager2.getDesktop(Win32ShellFolderManager2.java:87)
at sun.awt.shell.Win32ShellFolderManager2.get(Win32ShellFolderManager2.java:187)
at sun.awt.shell.ShellFolder.get(ShellFolder.java:218)
at javax.swing.filechooser.FileSystemView.getRoots(FileSystemView.java:363)
at bug6570445.main(bug6570445.java:6)
Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission shutdownHooks)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
at java.security.AccessController.checkPermission(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.Runtime.addShutdownHook(Runtime.java:190)
at sun.awt.shell.Win32ShellFolder2$ComTaskExecutor.<init>(Win32ShellFolder2.java:1169)
at sun.awt.shell.Win32ShellFolder2$ComTaskExecutor.<clinit>(Win32ShellFolder2.java:1158)
... 9 more