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

Unit test ServiceWithSecurityManagerTest fails on Linux

    Details

      Description

      Run "ant test" from the top level working directory. Eventually it fails with:

          [junit] Testsuite: javafx.concurrent.ServiceWithSecurityManagerTest
          [junit] java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "shutdownHooks")
          [junit] at java.security.AccessControlContext.checkPermission(AccessControlContext.java:366)
          [junit] at java.security.AccessController.checkPermission(AccessController.java:555)
          [junit] at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
          [junit] at javafx.concurrent.ServiceWithSecurityManagerTest$ServiceTestRunner$StrictSecurityManager.checkPermission(ServiceWithSecurityManagerTest.java:107)
          [junit] at java.lang.Runtime.addShutdownHook(Runtime.java:207)
          [junit] at com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:242)
          [junit] at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:205)
          [junit] at javafx.concurrent.Service.<clinit>(Service.java:105)
          [junit] at javafx.concurrent.ServiceLifecycleTest.setupService(ServiceLifecycleTest.java:58)
          [junit] at javafx.concurrent.ServiceTestBase.setup(ServiceTestBase.java:62)
          [junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          [junit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          [junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          [junit] at java.lang.reflect.Method.invoke(Method.java:601)
          [junit] at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
          [junit] at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
          [junit] at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
          [junit] at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
          [junit] at javafx.concurrent.ServiceWithSecurityManagerTest$ServiceTestRunner$1$1.run(ServiceWithSecurityManagerTest.java:73)
          [junit] at java.lang.Thread.run(Thread.java:722)
          [junit] Tests run: 120, Failures: 0, Errors: 120, Time elapsed: 0.384 sec

      It looks like the following change is required:

      --- a/javafx-ui-quantum/src/com/sun/javafx/tk/quantum/QuantumToolkit.java Wed May 09 15:40:17 2012 -0700
      +++ b/javafx-ui-quantum/src/com/sun/javafx/tk/quantum/QuantumToolkit.java Thu May 10 12:38:18 2012 +0300
      @@ -239,7 +239,13 @@
                           dispose();
                       }
                   };
      - Runtime.getRuntime().addShutdownHook(shutdownHook);
      + AccessController.doPrivileged(new PrivilegedAction<Void>() {
      + @Override public Void run() {
      + Runtime.getRuntime().addShutdownHook(shutdownHook);
      + return null;
      + }
      +
      + });
               }
               return true;
           }

        Attachments

          Activity

            People

            • Assignee:
              kcr Kevin Rushforth
              Reporter:
              dblaukop Daniel Blaukopf (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: