177 |
{ |
{ |
178 |
if (classloader == null) |
if (classloader == null) |
179 |
{ |
{ |
180 |
// Check if we may get the system classloader |
// Check if we may access the bootstrap classloader |
181 |
SecurityManager sm = System.getSecurityManager(); |
SecurityManager sm = System.getSecurityManager(); |
182 |
if (sm != null) |
if (sm != null) |
183 |
{ |
{ |
184 |
// Get the calling class and classloader |
// Get the calling class and classloader |
185 |
Class c = VMSecurityManager.getClassContext()[1]; |
Class c = VMSecurityManager.getClassContext()[1]; |
186 |
ClassLoader cl = c.getClassLoader(); |
ClassLoader cl = c.getClassLoader(); |
187 |
if (cl != null && cl != ClassLoader.systemClassLoader) |
if (cl != null) |
188 |
sm.checkPermission(new RuntimePermission("getClassLoader")); |
sm.checkPermission(new RuntimePermission("getClassLoader")); |
189 |
} |
} |
190 |
classloader = ClassLoader.systemClassLoader; |
return VMClassLoader.loadClass(name, initialize); |
191 |
} |
} |
192 |
return classloader.loadClass(name, initialize); |
return classloader.loadClass(name, initialize); |
193 |
} |
} |