Security manager to use when running Cobertura classes directly.
The Main class that implements Cobertura's coverage check functionality
uses System.exit when it is done which is fine for a standalone
utility, but bad in terms of using it from within another program like
a build tool.
This implementation denies access to the System.exit method, but saves the exit status so that the caller can decide if the build needs to be failed or not.
| Type | Name and description |
|---|---|
java.lang.SecurityManager |
delegate |
int |
exitStatus |
| Constructor and description |
|---|
CoberturaSecurityManager
(java.lang.SecurityManager delegate)Make a new SecurityManager that delegates to another SecurityManager for all things except System.exit calls. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
void |
checkExit(int exitStatus)Throws a SecurityException because we don't want Cobertura trying to exit the VM. |
|
void |
checkPermission(java.security.Permission perm)Throws a SecurityException if the requested access, specified by the given permission, is not permitted based on the security policy currently in effect. |
|
void |
checkPermission(java.security.Permission perm, java.lang.Object context)Throws a SecurityException if the requested access, specified by the given permission, is not permitted based on the security policy currently in effect. |
| Methods inherited from class | Name |
|---|---|
class java.lang.SecurityManager |
java.lang.SecurityManager#checkPackageAccess(java.lang.String), java.lang.SecurityManager#checkPermission(java.security.Permission), java.lang.SecurityManager#checkPermission(java.security.Permission, java.lang.Object), java.lang.SecurityManager#checkCreateClassLoader(), java.lang.SecurityManager#checkPropertiesAccess(), java.lang.SecurityManager#checkPropertyAccess(java.lang.String), java.lang.SecurityManager#getThreadGroup(), java.lang.SecurityManager#getSecurityContext(), java.lang.SecurityManager#checkAccess(java.lang.Thread), java.lang.SecurityManager#checkAccess(java.lang.ThreadGroup), java.lang.SecurityManager#checkExit(int), java.lang.SecurityManager#checkExec(java.lang.String), java.lang.SecurityManager#checkLink(java.lang.String), java.lang.SecurityManager#checkRead(java.lang.String, java.lang.Object), java.lang.SecurityManager#checkRead(java.lang.String), java.lang.SecurityManager#checkRead(java.io.FileDescriptor), java.lang.SecurityManager#checkWrite(java.io.FileDescriptor), java.lang.SecurityManager#checkWrite(java.lang.String), java.lang.SecurityManager#checkDelete(java.lang.String), java.lang.SecurityManager#checkConnect(java.lang.String, int), java.lang.SecurityManager#checkConnect(java.lang.String, int, java.lang.Object), java.lang.SecurityManager#checkListen(int), java.lang.SecurityManager#checkAccept(java.lang.String, int), java.lang.SecurityManager#checkMulticast(java.net.InetAddress, byte), java.lang.SecurityManager#checkMulticast(java.net.InetAddress), java.lang.SecurityManager#checkPrintJobAccess(), java.lang.SecurityManager#checkPackageDefinition(java.lang.String), java.lang.SecurityManager#checkSetFactory(), java.lang.SecurityManager#checkSecurityAccess(java.lang.String), java.lang.SecurityManager#wait(long), java.lang.SecurityManager#wait(long, int), java.lang.SecurityManager#wait(), java.lang.SecurityManager#equals(java.lang.Object), java.lang.SecurityManager#toString(), java.lang.SecurityManager#hashCode(), java.lang.SecurityManager#getClass(), java.lang.SecurityManager#notify(), java.lang.SecurityManager#notifyAll() |
Make a new SecurityManager that delegates to another SecurityManager for all things except System.exit calls. The delegate should be set to whatever security manager was in place before setting this one.
oldSecurityManager - the security manager to use as a delegate.Throws a SecurityException because we don't want Cobertura trying to exit the VM. Saves the exit status first so that callers can find out what the exit code would have been.
exitStatus - the exit statusThrows a SecurityException if the requested access, specified by the given permission, is not permitted based on the security policy currently in effect.
This implementation permits everything, unless there is a delegate, in which case it does whatever the delegate requests.
perm - the requested permissionThrows a SecurityException if the requested access, specified by the given permission, is not permitted based on the security policy currently in effect.
This implementation permits everything, unless there is a delegate, in which case it does whatever the delegate requests.
perm - the requested permissioncontext - a system dependent security context.Groovy Documentation