Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8108304

AccessControlException on changing the window icon in an unsigned application

XMLWordPrintable

      If you attempt to change the icon of the Stage in an unsigned application, it throws an AccessControlException. This will cause the entire application to hang on startup.

      Here is a very simple example to reproduce this:
      Stage {
          width: 640
          height: 360
          title: "Shelf Test"
          icons: Image {
              url: "http://jfxtras.org/portal/webdav/liferay.com/guest/document_library/Samples/JFXtrasDemo/JFXtrasShelf/images/image%%20(9).jpg"
          }
      }
      (you will need to modify the url to be an image on the same server)

      And here is the associated stack trace (fixed):
      java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)
      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.checkMemberAccess(Unknown Source)
      at java.lang.Class.checkMemberAccess(Unknown Source)
      at java.lang.Class.getDeclaredMethod(Unknown Source)
      at com.sun.javafx.tk.swing.WindowStage.setIcons(Unknown Source)
      at javafx.stage.Stage$_SBECL.onChange(Unknown Source)
      at com.sun.javafx.runtime.location.SequenceVariable.notifyListeners(Unknown Source)
      at com.sun.javafx.runtime.location.SequenceVariable.setAsSequence(Unknown Source)
      at org.jfxtras.scene.control.ShelfTest.javafx$run$(ShelfTest.fx:83)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at com.sun.javafx.runtime.provider.GUIRuntimeProvider$1.run(Unknown Source)
      at com.sun.javafx.tk.swing.SwingToolkit$StartupRoutine.run(Unknown Source)
      at java.awt.event.InvocationEvent.dispatch(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(Unknown Source)


      The only workaround is to not use Stage icons.

            kcr Kevin Rushforth
            schin Stephen Chin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: