org.apache.lucene.util
Class TestSecurityManager

java.lang.Object
  extended by java.lang.SecurityManager
      extended by org.apache.lucene.util.TestSecurityManager

public final class TestSecurityManager
extends SecurityManager

A SecurityManager that prevents tests calling System.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.util.TestSecurityManager.


Field Summary
 
Fields inherited from class java.lang.SecurityManager
inCheck
 
Constructor Summary
TestSecurityManager()
          Creates a new TestSecurityManager.
 
Method Summary
 void checkExit(int status)
          
 
Methods inherited from class java.lang.SecurityManager
checkAccept, checkAccess, checkAccess, checkAwtEventQueueAccess, checkConnect, checkConnect, checkCreateClassLoader, checkDelete, checkExec, checkLink, checkListen, checkMemberAccess, checkMulticast, checkMulticast, checkPackageAccess, checkPackageDefinition, checkPermission, checkPermission, checkPrintJobAccess, checkPropertiesAccess, checkPropertyAccess, checkRead, checkRead, checkRead, checkSecurityAccess, checkSetFactory, checkSystemClipboardAccess, checkTopLevelWindow, checkWrite, checkWrite, classDepth, classLoaderDepth, currentClassLoader, currentLoadedClass, getClassContext, getInCheck, getSecurityContext, getThreadGroup, inClass, inClassLoader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestSecurityManager

public TestSecurityManager()
Creates a new TestSecurityManager. This ctor is called on JVM startup, when -Djava.security.manager=org.apache.lucene.util.TestSecurityManager is passed to JVM.

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 class SecurityManager
Throws:
SecurityException - if the caller of this method is not the test runner itself.


Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.