提交 c008dc6a 编写于 作者: C chegar

8190482: InnocuousThread creation should not require the caller to possess...

8190482: InnocuousThread creation should not require the caller to possess enableContextClassLoaderOverride
Reviewed-by: rriggs, mchung
上级 b48c7a30
......@@ -62,10 +62,16 @@ public final class InnocuousThread extends Thread {
* set to the system class loader.
*/
public static Thread newThread(String name, Runnable target) {
return new InnocuousThread(INNOCUOUSTHREADGROUP,
target,
name,
ClassLoader.getSystemClassLoader());
return AccessController.doPrivileged(
new PrivilegedAction<Thread>() {
@Override
public Thread run() {
return new InnocuousThread(INNOCUOUSTHREADGROUP,
target,
name,
ClassLoader.getSystemClassLoader());
}
});
}
/**
......@@ -80,8 +86,14 @@ public final class InnocuousThread extends Thread {
* Returns a new InnocuousThread with null context class loader.
*/
public static Thread newSystemThread(String name, Runnable target) {
return new InnocuousThread(INNOCUOUSTHREADGROUP,
target, name, null);
return AccessController.doPrivileged(
new PrivilegedAction<Thread>() {
@Override
public Thread run() {
return new InnocuousThread(INNOCUOUSTHREADGROUP,
target, name, null);
}
});
}
private InnocuousThread(ThreadGroup group, Runnable target, String name, ClassLoader tccl) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册