Package com.sun.javatest
Class JavaTestSecurityManager
- java.lang.Object
-
- java.lang.SecurityManager
-
- com.sun.javatest.JavaTestSecurityManager
-
public class JavaTestSecurityManager extends java.lang.SecurityManager
This class is set for JT Harness running as an application. Currently, it imposes almost no security restrictions at all: its existence prevents anyone else (e.g. a test running in this JVM) from setting a more restrictive security manager.Although not required for running under JDK1.0.2, extra definitions for forward compatibility with JDK1.1 are also provided. They will effectively be ignored by JDK1.0.2.
-
-
Constructor Summary
Constructors Constructor Description JavaTestSecurityManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
checkAccept(java.lang.String host, int port)
void
checkAccess(java.lang.Thread g)
void
checkAccess(java.lang.ThreadGroup g)
void
checkAwtEventQueueAccess()
Deprecated.void
checkConnect(java.lang.String host, int port)
void
checkConnect(java.lang.String host, int port, java.lang.Object context)
void
checkCreateClassLoader()
void
checkDelete(java.lang.String file)
void
checkExec(java.lang.String cmd)
void
checkExit(int status)
void
checkLink(java.lang.String lib)
void
checkListen(int port)
void
checkMemberAccess(java.lang.Class<?> clazz, int which)
Deprecated.void
checkMulticast(java.net.InetAddress maddr)
void
checkMulticast(java.net.InetAddress maddr, byte ttl)
void
checkPackageAccess(java.lang.String pkg)
void
checkPackageDefinition(java.lang.String pkg)
void
checkPrintJobAccess()
void
checkPropertiesAccess()
void
checkPropertyAccess(java.lang.String key)
void
checkRead(java.io.FileDescriptor fd)
void
checkRead(java.lang.String file)
void
checkRead(java.lang.String file, java.lang.Object context)
void
checkSecurityAccess(java.lang.String provider)
void
checkSetFactory()
void
checkSystemClipboardAccess()
Deprecated.boolean
checkTopLevelWindow(java.lang.Object window)
Deprecated.void
checkWrite(java.io.FileDescriptor fd)
void
checkWrite(java.lang.String file)
static void
install()
Please note that the new default behaviour is NOT installing JavaTestSecurityManager.static boolean
setAllowExit(boolean bool)
Set whether or not the JVM may be exited.boolean
setAllowPropertiesAccess(boolean bool)
Set whether or not the set of system properties may be accessed.
-
-
-
Method Detail
-
install
public static void install()
Please note that the new default behaviour is NOT installing JavaTestSecurityManager. This method would try to install a copy of this security manager only if "javatest.security.noSecurityManager" property is set to something else than 'true' (ignoring case). If "javatest.security.noSecurityManager" is not defined, security manager still would not be installed. The install can be enabled by setting system property "javatest.security.noSecurityManager" to 'false'. If another security manager is already installed, the install will fail; a warning message will be written to the console if the previously installed security manager is not a subtype of com.sun.javatest.JavaTestSecurityManager.
-
checkAccept
public void checkAccept(java.lang.String host, int port)
- Overrides:
checkAccept
in classjava.lang.SecurityManager
-
checkAccess
public void checkAccess(java.lang.Thread g)
- Overrides:
checkAccess
in classjava.lang.SecurityManager
-
checkAccess
public void checkAccess(java.lang.ThreadGroup g)
- Overrides:
checkAccess
in classjava.lang.SecurityManager
-
checkConnect
public void checkConnect(java.lang.String host, int port)
- Overrides:
checkConnect
in classjava.lang.SecurityManager
-
checkConnect
public void checkConnect(java.lang.String host, int port, java.lang.Object context)
- Overrides:
checkConnect
in classjava.lang.SecurityManager
-
checkCreateClassLoader
public void checkCreateClassLoader()
- Overrides:
checkCreateClassLoader
in classjava.lang.SecurityManager
-
checkDelete
public void checkDelete(java.lang.String file)
- Overrides:
checkDelete
in classjava.lang.SecurityManager
-
checkExec
public void checkExec(java.lang.String cmd)
- Overrides:
checkExec
in classjava.lang.SecurityManager
-
checkExit
public void checkExit(int status)
- Overrides:
checkExit
in classjava.lang.SecurityManager
-
checkLink
public void checkLink(java.lang.String lib)
- Overrides:
checkLink
in classjava.lang.SecurityManager
-
checkListen
public void checkListen(int port)
- Overrides:
checkListen
in classjava.lang.SecurityManager
-
checkPackageAccess
public void checkPackageAccess(java.lang.String pkg)
- Overrides:
checkPackageAccess
in classjava.lang.SecurityManager
-
checkPackageDefinition
public void checkPackageDefinition(java.lang.String pkg)
- Overrides:
checkPackageDefinition
in classjava.lang.SecurityManager
-
checkPropertiesAccess
public void checkPropertiesAccess()
- Overrides:
checkPropertiesAccess
in classjava.lang.SecurityManager
-
checkPropertyAccess
public void checkPropertyAccess(java.lang.String key)
- Overrides:
checkPropertyAccess
in classjava.lang.SecurityManager
-
checkRead
public void checkRead(java.io.FileDescriptor fd)
- Overrides:
checkRead
in classjava.lang.SecurityManager
-
checkRead
public void checkRead(java.lang.String file)
- Overrides:
checkRead
in classjava.lang.SecurityManager
-
checkRead
public void checkRead(java.lang.String file, java.lang.Object context)
- Overrides:
checkRead
in classjava.lang.SecurityManager
-
checkSetFactory
public void checkSetFactory()
- Overrides:
checkSetFactory
in classjava.lang.SecurityManager
-
checkTopLevelWindow
@Deprecated public boolean checkTopLevelWindow(java.lang.Object window)
Deprecated.Still temporarily kept for compatibility with JDK7, the overridden methods are deprecated in SE8 and removed in SE11
-
checkWrite
public void checkWrite(java.io.FileDescriptor fd)
- Overrides:
checkWrite
in classjava.lang.SecurityManager
-
checkWrite
public void checkWrite(java.lang.String file)
- Overrides:
checkWrite
in classjava.lang.SecurityManager
-
checkAwtEventQueueAccess
@Deprecated public void checkAwtEventQueueAccess()
Deprecated.Still temporarily kept for compatibility with JDK7, the overridden methods are deprecated in SE8 and removed in SE11
-
checkMemberAccess
@Deprecated public void checkMemberAccess(java.lang.Class<?> clazz, int which)
Deprecated.Still temporarily kept for compatibility with JDK7, the overridden methods are deprecated in SE8 and removed in SE11
-
checkMulticast
public void checkMulticast(java.net.InetAddress maddr)
- Overrides:
checkMulticast
in classjava.lang.SecurityManager
-
checkMulticast
public void checkMulticast(java.net.InetAddress maddr, byte ttl)
- Overrides:
checkMulticast
in classjava.lang.SecurityManager
-
checkPrintJobAccess
public void checkPrintJobAccess()
- Overrides:
checkPrintJobAccess
in classjava.lang.SecurityManager
-
checkSecurityAccess
public void checkSecurityAccess(java.lang.String provider)
- Overrides:
checkSecurityAccess
in classjava.lang.SecurityManager
-
checkSystemClipboardAccess
@Deprecated public void checkSystemClipboardAccess()
Deprecated.Still temporarily kept for compatibility with JDK7, the overridden methods are deprecated in SE8 and removed in SE11
-
setAllowExit
public static boolean setAllowExit(boolean bool)
Set whether or not the JVM may be exited. The default value is "false".- Parameters:
bool
- true if the JVM may be exited, and false otherwise- Returns:
- the previous value of this setting
-
setAllowPropertiesAccess
public boolean setAllowPropertiesAccess(boolean bool)
Set whether or not the set of system properties may be accessed. The default value is determined by the system property "javatest.security.allowPropertiesAccess".- Parameters:
bool
- true if the system properties may be accessed, and false otherwise- Returns:
- the previous value of this setting
-
-