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

Swing interop fails when run with a security manager with standalone SDK

XMLWordPrintable

      To reproduce this, run the following test with the standalone FX SDK (using an OpenJDK 10 build as a boot JDK).

      $ gradle -PFULL_TEST=true :systemTests:test --tests test.sandbox.SandboxAppTest

      The following two test cases will fail:

      test.sandbox.SandboxAppTest > testJFXPanelApp FAILED
          junit.framework.AssertionFailedError: test.sandbox.app.JFXPanelApp: Application failed with a security exception
              at test.sandbox.SandboxAppTest.runSandboxedApp(SandboxAppTest.java:85)
              at test.sandbox.SandboxAppTest.runSandboxedApp(SandboxAppTest.java:51)
              at test.sandbox.SandboxAppTest.testJFXPanelApp(SandboxAppTest.java:114)

      Here is the exception from the launched application:

      java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.sun.java2d")
      at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
      at java.base/java.security.AccessController.checkPermission(AccessController.java:895)
      at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:335)
      at java.base/java.lang.SecurityManager.checkPackageAccess(SecurityManager.java:1311)
      at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:186)
      at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
      at javafx.swing/javafx.embed.swing.JFXPanel.updateComponentSize(JFXPanel.java:573)
      at javafx.swing/javafx.embed.swing.JFXPanel.addNotify(JFXPanel.java:883)
      at java.desktop/java.awt.Container.addNotify(Container.java:2797)
      at java.desktop/javax.swing.JComponent.addNotify(JComponent.java:4783)
      at java.desktop/java.awt.Container.addNotify(Container.java:2797)
      at java.desktop/javax.swing.JComponent.addNotify(JComponent.java:4783)
      at java.desktop/java.awt.Container.addNotify(Container.java:2797)
      at java.desktop/javax.swing.JComponent.addNotify(JComponent.java:4783)
      at java.desktop/javax.swing.JRootPane.addNotify(JRootPane.java:733)
      at java.desktop/java.awt.Container.addNotify(Container.java:2797)
      at java.desktop/java.awt.Window.addNotify(Window.java:786)
      at java.desktop/java.awt.Frame.addNotify(Frame.java:490)
      at java.desktop/java.awt.Window.pack(Window.java:824)
      at test.sandbox.app.JFXPanelApp.initApp(JFXPanelApp.java:78)
      at test.sandbox.app.JFXPanelApp.<init>(JFXPanelApp.java:136)
      at test.sandbox.app.JFXPanelApp.lambda$runTest$3(JFXPanelApp.java:154)
      at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
      at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
      at java.desktop/java.awt.EventQueue.access$600(EventQueue.java:97)
      at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
      at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
      at java.base/java.security.AccessController.doPrivileged(Native Method)
      at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
      at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
      at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
      at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
      at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
      at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
      at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
      at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)


      test.sandbox.SandboxAppTest > testJFXPanelImplicitExitApp FAILED
          junit.framework.AssertionFailedError: test.sandbox.app.JFXPanelImplicitExitApp: Application failed with a security exception
              at test.sandbox.SandboxAppTest.runSandboxedApp(SandboxAppTest.java:85)
              at test.sandbox.SandboxAppTest.testJFXPanelImplicitExitApp(SandboxAppTest.java:119)

      The launched application for this test gets the same exception.

            kcr Kevin Rushforth
            kcr Kevin Rushforth
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: