Methods Summary |
---|
public void | checkAccess(java.lang.Thread t)
ThreadGroup current = Thread.currentThread().getThreadGroup();
if (!current.parentOf(t.getThreadGroup()))
super.checkAccess(t);
|
public void | checkAccess(java.lang.ThreadGroup tg)
ThreadGroup current = Thread.currentThread().getThreadGroup();
if (!current.parentOf(tg))
super.checkAccess(tg);
|
public void | checkConnect(java.lang.String host, int port)
try {
super.checkConnect(host, port);
return;
} catch (AccessControlException ace) {
// continue
}
// Starting in 1.2 beta 4, we can't depend upon the currentClassLoader
// method anymore. In fact, this code is better taken care of in
// the class loader itself, using the getPermissions() method that
// was introduced in 1.2 beta 4
ClassLoader loader = getNonSystemClassLoader();
String remoteHost;
if (loader == null)
return;
if (!(loader instanceof JavaRunnerLoader)) {
System.err.println("Class loader out of sync");
return;
}
JavaRunnerLoader cl = (JavaRunnerLoader) loader;
remoteHost = cl.getHost();
if (host.equals(remoteHost))
return;
// Note that this entire block has been re-written for 1.2 beta 4
// to use the new doPrivileged interface
try {
class testHost implements PrivilegedExceptionAction {
String local, remote;
testHost(String local, String remote) {
this.local = local;
this.remote = remote;
}
public Object run() throws UnknownHostException {
InetAddress hostAddr = InetAddress.getByName(local);
InetAddress remoteAddr = InetAddress.getByName(remote);
if (hostAddr.equals(remoteAddr))
return new Boolean("true");
return new Boolean("false");
}
}
testHost th = new testHost(host, remoteHost);
Boolean b = (Boolean) AccessController.doPrivileged(th);
if (b.booleanValue())
return;
} catch (PrivilegedActionException pae) {
// Must be an UnknownHostException; continue and throw exception
}
throw new SecurityException(
"Can't connect from " + remoteHost + " to " + host);
|
public void | checkExit(int status)
|
public void | checkPackageAccess(java.lang.String pkg)
|
public void | checkPackageDefinition(java.lang.String pkg)
if (!pkg.startsWith("java."))
return;
try {
super.checkPackageDefinition(pkg);
return;
} catch (AccessControlException ace) {
// continue
}
if (inClassLoader())
throw new SecurityException("Can't define sun/java classes");
|
private java.lang.ClassLoader | getNonSystemClassLoader()
Class c[] = getClassContext();
ClassLoader sys = ClassLoader.getSystemClassLoader();
for (int i = 1; i < c.length; i++) {
ClassLoader cl = c[i].getClassLoader();
if (cl != null && !cl.equals(sys))
return cl;
}
return null;
|