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

[linux] Exception initializing the JavaFX runtime when a security manager is enabled

    XMLWordPrintable

Details

    • b10
    • b11

    Description

      To reproduce this, run the following system test:

      $ gradle --info -PFULL_TEST=true cleanTest :systemTests:test --tests SandboxAppTest

      WARNING: A command line option has enabled the Security Manager
      WARNING: The Security Manager is deprecated and will be removed in a future release
      WARNING: A command line option has enabled the Security Manager
      WARNING: The Security Manager is deprecated and will be removed in a future release
      java.lang.RuntimeException: java.lang.ExceptionInInitializerError
              at javafx.graphics@21-internal/com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:300)
              at javafx.graphics@21-internal/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:292)
              at javafx.graphics@21-internal/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:162)
              at javafx.graphics@21-internal/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:651)
              at javafx.graphics@21-internal/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:671)
              at javafx.graphics@21-internal/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
              at java.base/java.lang.Thread.run(Thread.java:1589)
      Caused by: java.lang.ExceptionInInitializerError
              at javafx.graphics@21-internal/com.sun.glass.ui.gtk.GtkPlatformFactory.createApplication(GtkPlatformFactory.java:40)
              at javafx.graphics@21-internal/com.sun.glass.ui.Application.run(Application.java:146)
              at javafx.graphics@21-internal/com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:290)
              ... 6 more
      Caused by: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "org.eclipse.swt.internal.gtk.version" "read")
              at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:485)
              at java.base/java.security.AccessController.checkPermission(AccessController.java:1068)
              at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:411)
              at java.base/java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1155)
              at java.base/java.lang.System.getProperty(System.java:961)
              at javafx.graphics@21-internal/com.sun.glass.ui.gtk.GtkApplication.<clinit>(GtkApplication.java:66)
              ... 9 more

      SandboxAppTest > testFXNonApp FAILED
          junit.framework.AssertionFailedError: test.sandbox.app.FXNonApp: Application failed with a security exception
              at test.sandbox.SandboxAppTest.runSandboxedApp(SandboxAppTest.java:91)
              at test.sandbox.SandboxAppTest.runSandboxedApp(SandboxAppTest.java:57)
              at test.sandbox.SandboxAppTest.runSandboxedApp(SandboxAppTest.java:53)
              at test.sandbox.SandboxAppTest.testFXNonApp(SandboxAppTest.java:122)


      Alternaitvely, run the attached test program as follows:

      $ java @JAVAFXROOT/build/run.args -Djava.security.manager -Djava.security.policy=JAVAFXROOT/build/run.java.policy PlatformStartupTest
      WARNING: A command line option has enabled the Security Manager
      WARNING: The Security Manager is deprecated and will be removed in a future release
      Exception in thread "main" java.lang.RuntimeException: java.lang.ExceptionInInitializerError
              at javafx.graphics@21-internal/com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:300)
              at javafx.graphics@21-internal/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:292)
              at javafx.graphics@21-internal/javafx.application.Platform.startup(Platform.java:113)
              at PlatformStartupTest.main(PlatformStartupTest.java:5)
      Caused by: java.lang.ExceptionInInitializerError
              at javafx.graphics@21-internal/com.sun.glass.ui.gtk.GtkPlatformFactory.createApplication(GtkPlatformFactory.java:40)
              at javafx.graphics@21-internal/com.sun.glass.ui.Application.run(Application.java:146)
              at javafx.graphics@21-internal/com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:290)
              ... 3 more
      Caused by: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "org.eclipse.swt.internal.gtk.version" "read")
              at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:485)
              at java.base/java.security.AccessController.checkPermission(AccessController.java:1068)
              at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:411)
              at java.base/java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1155)
              at java.base/java.lang.System.getProperty(System.java:961)
              at javafx.graphics@21-internal/com.sun.glass.ui.gtk.GtkApplication.<clinit>(GtkApplication.java:66)
              ... 6 more

      This regression is caused by the fix for JDK-8299595. The reading of the "org.eclipse.swt.internal.gtk.version" property was moved outside of a doPrivileged block, and I missed this during my review.

      Attachments

        Issue Links

          Activity

            People

              tsayao Thiago Sayao
              kcr Kevin Rushforth
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: