system-rules icon indicating copy to clipboard operation
system-rules copied to clipboard

System-Rules Security Manager feature with gradle

Open erkinun opened this issue 10 years ago • 2 comments
trafficstars

Hi,

When I try to use System-Rules' security manager property, gradle just hangs when trying to run the tests. The issue might be related to the gradle bug: https://issues.gradle.org/browse/GRADLE-2170 , but nevertheless is there any workaround for this problem?

example test:

public class UtilTest {

    private final BuildSecurityManager manager = new BuildSecurityManager();

    @Rule
    public final ProvideSecurityManager provideSecurityManager = new ProvideSecurityManager(manager);

I then run gradle clean test

The result:

FAILURE: Build failed with an exception.

* What went wrong:
Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.launcher.daemon.client.DaemonDisappearedException: Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)
    at org.gradle.launcher.daemon.client.DaemonClient.handleDaemonDisappearance(DaemonClient.java:211)
    at org.gradle.launcher.daemon.client.DaemonClient.monitorBuild(DaemonClient.java:187)
    at org.gradle.launcher.daemon.client.DaemonClient.executeBuild(DaemonClient.java:151)
    at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:120)
    at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:78)
    at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)
    at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:170)
    at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
    at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
    at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
    at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
    at org.gradle.launcher.Main.doAction(Main.java:33)
    at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
    at org.gradle.launcher.GradleMain.main(GradleMain.java:23)

erkinun avatar Sep 14 '15 15:09 erkinun

Relating Stack Overflow question: http://stackoverflow.com/questions/32584997/setting-a-custom-security-manager-when-running-junit-with-gradle

stefanbirkner avatar Sep 15 '15 12:09 stefanbirkner

I asked that question today unfortunately : )

erkinun avatar Sep 15 '15 12:09 erkinun