JFileChooser with Security Manger
843811May 6 2009 — edited May 7 2009Hello,
I developed a swing application using JFileChooser. I'll recommend using the security manager and deliver a simple policy. The application works properly. But it throws an exception in XP:
Exception in thread "Basic L&F File Loading Thread" java.security.AccessControlE
xception: access denied (java.lang.RuntimePermission modifyThread)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkAccess(Unknown Source)
at java.lang.Thread.checkAccess(Unknown Source)
at java.lang.Thread.interrupt(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerCancel(Unknown Source)
at java.util.concurrent.FutureTask.cancel(Unknown Source)
at sun.awt.shell.Win32ShellFolderManager2$ComInvoker.invoke(Unknown Sour
ce)
at javax.swing.plaf.basic.BasicDirectoryModel$LoadFilesThread.run0(Unkno
wn Source)
at javax.swing.plaf.basic.BasicDirectoryModel$LoadFilesThread.run(Unknow
n Source)
It seems as if the JFileChooser does not really need this permission. So I will recommend to ignore it. Hackers would probably take it as an invitation.
Is this a bug?
In a small test project I can see that setting a file filter causes this problem.
I need a explanation for the users. Why does JFileChooser expect this permission?