Avoid security manager check for assembly class loaders. The runtime should be priviliged to create the default assembly class loader and a custom security manager might recursively require the assembly class loader to be loaded (which is only "supported" for custom assembly class loaders).

This commit is contained in:
jfrijters 2010-11-03 07:55:11 +00:00
Родитель 32238d1dcd
Коммит 5a3a196d92
3 изменённых файлов: 15 добавлений и 3 удалений

Просмотреть файл

@ -43,7 +43,13 @@ public final class AssemblyClassLoader extends ClassLoader
public AssemblyClassLoader(Assembly assembly)
{
super(null);
this(assembly, System.getSecurityManager());
}
// this constructor is used by the runtime to avoid the security check (by passing in null as the security manager)
AssemblyClassLoader(Assembly assembly, SecurityManager security)
{
super(null, security);
this.assembly = assembly;
}

Просмотреть файл

@ -216,7 +216,13 @@ public abstract class ClassLoader {
* @since 1.2
*/
protected ClassLoader(ClassLoader parent) {
SecurityManager security = System.getSecurityManager();
this(parent, System.getSecurityManager());
}
// private constructor for use by ikvm.runtime.AssemblyClassLoader
// (to skip the security manager check)
@ikvm.lang.Internal
protected ClassLoader(ClassLoader parent, SecurityManager security) {
if (security != null) {
security.checkCreateClassLoader();
}

Просмотреть файл

@ -1159,7 +1159,7 @@ namespace IKVM.Internal
public object run()
{
return new ikvm.runtime.AssemblyClassLoader(assembly);
return new ikvm.runtime.AssemblyClassLoader(assembly, null);
}
}