Package org.fest.swing.security
Class NoExitSecurityManager
java.lang.Object
java.lang.SecurityManager
org.fest.swing.security.NoExitSecurityManager
Understands a
SecurityManager that does not allow an application under test to terminate the
current JVM. Adapted from Abbot's NoExitSecurityManager.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ExitCallHookprivate static final ExitCallHookprivate final org.fest.util.StackTraces -
Constructor Summary
ConstructorsConstructorDescriptionCreates a newNoExitSecurityManager.Creates a newNoExitSecurityManager.NoExitSecurityManager(ExitCallHook hook, org.fest.util.StackTraces stackTraces) -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckExit(int status) Throws anif an application tries to terminate the current JVM (throughExitExceptionorRuntime.exit(int).)Runtime.halt(int)voidcheckPermission(Permission permission) Allows everything.voidcheckPermission(Permission permission, Object context) Allows everything.private booleanIndicates whether "exit" has been invoked through a call oforRuntime.exit(int).Runtime.halt(int)private booleanMethods inherited from class java.lang.SecurityManager
checkAccept, checkAccess, checkAccess, checkConnect, checkConnect, checkCreateClassLoader, checkDelete, checkExec, checkLink, checkListen, checkMulticast, checkMulticast, checkPackageAccess, checkPackageDefinition, checkPrintJobAccess, checkPropertiesAccess, checkPropertyAccess, checkRead, checkRead, checkRead, checkSecurityAccess, checkSetFactory, checkWrite, checkWrite, getClassContext, getSecurityContext, getThreadGroup
-
Field Details
-
NULL_HOOK
-
hook
-
stackTraces
private final org.fest.util.StackTraces stackTraces
-
-
Constructor Details
-
NoExitSecurityManager
public NoExitSecurityManager()Creates a newNoExitSecurityManager. -
NoExitSecurityManager
Creates a newNoExitSecurityManager.- Parameters:
hook- notified when an application tries to terminate the current JVM.- Throws:
NullPointerException- if the given hook isnull.
-
NoExitSecurityManager
NoExitSecurityManager(ExitCallHook hook, org.fest.util.StackTraces stackTraces)
-
-
Method Details
-
checkPermission
Allows everything.- Overrides:
checkPermissionin classSecurityManager- Parameters:
permission- the specified permission.context- a system-dependent security context.
-
checkPermission
Allows everything.- Overrides:
checkPermissionin classSecurityManager- Parameters:
permission- the specified permission.
-
checkExit
public void checkExit(int status) Throws anif an application tries to terminate the current JVM (throughExitExceptionorRuntime.exit(int).)Runtime.halt(int)- Overrides:
checkExitin classSecurityManager- Parameters:
status- the exit status.- Throws:
ExitException- if an application tries to terminate the current JVM.
-
exitInvoked
private boolean exitInvoked()Indicates whether "exit" has been invoked through a call oforRuntime.exit(int).Runtime.halt(int)- Returns:
trueif an exit has been invoked through a call ofRuntime.exitorRuntime.halt;falseotherwise.
-
exitInvoked
-