JDK-7036025 : java.security.AccessControlException when creating JFileChooser in signed applet
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6u24
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2011-04-12
  • Updated: 2014-10-24
  • Resolved: 2011-07-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b142Fixed
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
1.6.0_24-b07

ADDITIONAL OS VERSION INFORMATION :
Windows XP Professional SP3

A DESCRIPTION OF THE PROBLEM :
When creating a JFileChooser in a signed applet like so:

    SwingUtilities.invokeAndWait(new Runnable()
     {
                public void run()
                {
                     JFileChooser fileChooser = new JFileChooser();
                     ...
                }
     )

An exception is thrown and the JFileChooser is not launched.

This problem does not occur in update 23.

REGRESSION.  Last worked in version 6

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Create JFileChooser as described above within a signed applet.
2) Attempt to run the applet in a web page
3) Notice JFileChooser does not come up
4) Observe Java Console for stack trace

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
JFileChooser should launch
ACTUAL -
JFileChooser did not launch and stack trace was produced in Java Console

ERROR MESSAGES/STACK TRACES THAT OCCUR :
The following exception is thrown:

java.security.AccessControlException: access denied (java.io.FilePermission C:\Documents and Settings\username\Recent read)
                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.checkRead(Unknown Source)
                at java.io.File.exists(Unknown Source)
                at java.io.Win32FileSystem.canonicalize(Unknown Source)
                at java.io.File.getCanonicalPath(Unknown Source)
                at sun.awt.shell.Win32ShellFolderManager2.createShellFolder(Unknown Source)
                at sun.awt.shell.Win32ShellFolderManager2.getRecent(Unknown Source)
                at sun.awt.shell.Win32ShellFolderManager2.get(Unknown Source)
                at sun.awt.shell.ShellFolder.get(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 package.MyClass$1.run(MyClass.java:56)
                at java.awt.event.InvocationEvent.dispatch(Unknown Source)
                at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
                at java.awt.EventQueue.access$000(Unknown Source)
                at java.awt.EventQueue$1.run(Unknown Source)
                at java.awt.EventQueue$1.run(Unknown Source)
                at java.security.AccessController.doPrivileged(Native Method)
                at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
                at java.awt.EventQueue.dispatchEvent(Unknown Source)
                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


REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
Use 1.6.0_23

Comments
EVALUATION The doPrivileged should be used while JFileChooser creating
17-04-2011