Package org.apache.lucene.tests.util
Class TestSecurityManager
- java.lang.Object
-
- java.lang.SecurityManager
-
- org.apache.lucene.tests.util.TestSecurityManager
-
public final class TestSecurityManager extends SecurityManager
ASecurityManager
that prevents tests callingSystem.exit(int)
. Only the test runner itself is allowed to exit the JVM. All other security checks are handled by the default security policy.Use this with
-Djava.security.manager=org.apache.lucene.tests.util.TestSecurityManager
.
-
-
Constructor Summary
Constructors Constructor Description TestSecurityManager()
Creates a new TestSecurityManager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkExit(int status)
-
Methods inherited from class java.lang.SecurityManager
checkAccept, checkAccess, checkAccess, checkConnect, checkConnect, checkCreateClassLoader, checkDelete, checkExec, checkLink, checkListen, checkMulticast, checkMulticast, checkPackageAccess, checkPackageDefinition, checkPermission, checkPermission, checkPrintJobAccess, checkPropertiesAccess, checkPropertyAccess, checkRead, checkRead, checkRead, checkSecurityAccess, checkSetFactory, checkWrite, checkWrite, getClassContext, getSecurityContext, getThreadGroup
-
-
-
-
Method Detail
-
checkExit
public void checkExit(int status)
This method inspects the stack trace and checks who is calling
System.exit(int)
and similar methods- Overrides:
checkExit
in classSecurityManager
- Throws:
SecurityException
- if the caller of this method is not the test runner itself.
-
-