Skip to content

Commit 523ff10

Browse files
committed
Remove SecurityManager
1 parent 473d93e commit 523ff10

File tree

5 files changed

+0
-109
lines changed

5 files changed

+0
-109
lines changed

src/main/java/org/codehaus/gmavenplus/mojo/AbstractToolsMojo.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,6 @@ public abstract class AbstractToolsMojo extends AbstractGroovyMojo {
7070
@Parameter
7171
protected Properties properties = new Properties();
7272

73-
/**
74-
* Whether to allow System.exit() to be used. Should not be set to <code>false</code> when using parallel
75-
* execution, as it isn't thread-safe.
76-
*
77-
* @since 1.2
78-
*/
79-
@Parameter(defaultValue = "true")
80-
protected boolean allowSystemExits;
81-
8273
/**
8374
* Whether to bind each property to a separate variable (otherwise binds properties to a single 'properties' variable).
8475
*

src/main/java/org/codehaus/gmavenplus/mojo/ConsoleMojo.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import org.apache.maven.plugins.annotations.Mojo;
2323
import org.apache.maven.plugins.annotations.Parameter;
2424
import org.apache.maven.plugins.annotations.ResolutionScope;
25-
import org.codehaus.gmavenplus.util.NoExitSecurityManager;
2625

2726
import java.io.File;
2827
import java.lang.reflect.InvocationTargetException;
@@ -86,12 +85,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
8685
}
8786

8887
if (groovyVersionSupportsAction()) {
89-
final SecurityManager sm = System.getSecurityManager();
9088
try {
91-
if (!allowSystemExits) {
92-
System.setSecurityManager(new NoExitSecurityManager());
93-
}
94-
9589
// get classes we need with reflection
9690
Class<?> consoleClass;
9791
try {
@@ -127,10 +121,6 @@ public void execute() throws MojoExecutionException, MojoFailureException {
127121
throw new MojoExecutionException("Unable to access a method on a Groovy class from classpath.", e);
128122
} catch (InstantiationException e) {
129123
throw new MojoExecutionException("Error occurred while instantiating a Groovy class from classpath.", e);
130-
} finally {
131-
if (!allowSystemExits) {
132-
System.setSecurityManager(sm);
133-
}
134124
}
135125
} else {
136126
getLog().error("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support running a console. The minimum version of Groovy required is " + minGroovyVersion + ". Skipping console startup.");

src/main/java/org/codehaus/gmavenplus/mojo/ExecuteMojo.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import org.apache.maven.plugins.annotations.ResolutionScope;
2424
import org.codehaus.gmavenplus.model.internal.Version;
2525
import org.codehaus.gmavenplus.util.FileUtils;
26-
import org.codehaus.gmavenplus.util.NoExitSecurityManager;
2726

2827
import java.io.BufferedReader;
2928
import java.io.File;
@@ -137,12 +136,7 @@ protected synchronized void doExecute() throws MojoExecutionException {
137136
}
138137

139138
if (groovyVersionSupportsAction()) {
140-
final SecurityManager sm = System.getSecurityManager();
141139
try {
142-
if (!allowSystemExits) {
143-
System.setSecurityManager(new NoExitSecurityManager());
144-
}
145-
146140
// get classes we need with reflection
147141
Class<?> groovyShellClass = classWrangler.getClass("groovy.lang.GroovyShell");
148142

@@ -159,10 +153,6 @@ protected synchronized void doExecute() throws MojoExecutionException {
159153
throw new MojoExecutionException("Error occurred while instantiating a Groovy class from classpath.", e);
160154
} catch (IllegalAccessException e) {
161155
throw new MojoExecutionException("Unable to access a method on a Groovy class from classpath.", e);
162-
} finally {
163-
if (!allowSystemExits) {
164-
System.setSecurityManager(sm);
165-
}
166156
}
167157
} else {
168158
getLog().error("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support script execution. The minimum version of Groovy required is " + minGroovyVersion + ". Skipping script execution.");

src/main/java/org/codehaus/gmavenplus/mojo/ShellMojo.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import org.apache.maven.plugins.annotations.Parameter;
2323
import org.apache.maven.plugins.annotations.ResolutionScope;
2424
import org.codehaus.gmavenplus.model.internal.Version;
25-
import org.codehaus.gmavenplus.util.NoExitSecurityManager;
2625

2726
import java.lang.reflect.InvocationTargetException;
2827
import java.lang.reflect.Method;
@@ -91,11 +90,7 @@ public void execute() throws MojoExecutionException {
9190
}
9291

9392
if (groovyVersionSupportsAction()) {
94-
final SecurityManager sm = System.getSecurityManager();
9593
try {
96-
if (!allowSystemExits) {
97-
System.setSecurityManager(new NoExitSecurityManager());
98-
}
9994

10095
// get classes we need with reflection
10196
Class<?> shellClass = classWrangler.getClass(groovyAtLeast(GROOVY_4_0_0_ALPHA1) ? "org.apache.groovy.groovysh.Groovysh" : "org.codehaus.groovy.tools.shell.Groovysh");
@@ -121,10 +116,6 @@ public void execute() throws MojoExecutionException {
121116
throw new MojoExecutionException("Unable to access a method on a Groovy class from classpath.", e);
122117
} catch (InstantiationException e) {
123118
throw new MojoExecutionException("Error occurred while instantiating a Groovy class from classpath.", e);
124-
} finally {
125-
if (!allowSystemExits) {
126-
System.setSecurityManager(sm);
127-
}
128119
}
129120
} else {
130121
getLog().error("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support running a shell. The minimum version of Groovy required is " + minGroovyVersion + ". Skipping shell startup.");

src/main/java/org/codehaus/gmavenplus/util/NoExitSecurityManager.java

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)