< prev index next >
src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java
Print this page
@@ -1164,11 +1164,21 @@
if (sm != null) {
checkPackageAccess(sm, fullName);
}
// Try finding using the "app" loader.
+ if (appLoader != null) {
return Class.forName(fullName, true, appLoader);
+ } else {
+ final Class<?> cl = Class.forName(fullName);
+ // return the Class only if it was loaded by boot loader
+ if (cl.getClassLoader() == null) {
+ return cl;
+ } else {
+ throw new ClassNotFoundException(fullName);
+ }
+ }
}
/**
* Hook to print stack trace for a {@link Throwable} that occurred during
* execution
< prev index next >