org.fest.swing.security
Class NoExitSecurityManager

java.lang.Object
  extended by java.lang.SecurityManager
      extended by org.fest.swing.security.NoExitSecurityManager

public class NoExitSecurityManager
extends SecurityManager

Understands a SecurityManager that does not allow an application under test to terminate the current JVM. Adapted from Abbot's NoExitSecurityManager.

Author:
Alex Ruiz

Field Summary
 
Fields inherited from class java.lang.SecurityManager
inCheck
 
Constructor Summary
NoExitSecurityManager()
          Creates a new NoExitSecurityManager.
NoExitSecurityManager(ExitCallHook hook)
          Creates a new NoExitSecurityManager.
 
Method Summary
 void checkExit(int status)
          Throws an ExitException if an application tries to terminate the current JVM (through Runtime.exit(int) or Runtime.halt(int).)
 void checkPermission(Permission permission)
          Allows everything.
 void checkPermission(Permission permission, Object context)
          Allows everything.
 
Methods inherited from class java.lang.SecurityManager
checkAccept, checkAccess, checkAccess, checkAwtEventQueueAccess, checkConnect, checkConnect, checkCreateClassLoader, checkDelete, checkExec, checkLink, checkListen, checkMemberAccess, checkMulticast, checkMulticast, checkPackageAccess, checkPackageDefinition, 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

NoExitSecurityManager

public NoExitSecurityManager()
Creates a new NoExitSecurityManager.


NoExitSecurityManager

public NoExitSecurityManager(ExitCallHook hook)
Creates a new NoExitSecurityManager.

Parameters:
hook - notified when an application tries to terminate the current JVM.
Throws:
NullPointerException - if the given hook is null.
Method Detail

checkPermission

public void checkPermission(Permission permission,
                            Object context)
Allows everything.

Overrides:
checkPermission in class SecurityManager
Parameters:
permission - the specified permission.
context - a system-dependent security context.

checkPermission

public void checkPermission(Permission permission)
Allows everything.

Overrides:
checkPermission in class SecurityManager
Parameters:
permission - the specified permission.

checkExit

public void checkExit(int status)
Throws an ExitException if an application tries to terminate the current JVM (through Runtime.exit(int) or Runtime.halt(int).)

Overrides:
checkExit in class SecurityManager
Parameters:
status - the exit status.
Throws:
ExitException - if an application tries to terminate the current JVM.


Copyright © 2007-2011 FEST (Fixtures for Easy Software Testing). All Rights Reserved.