8177656: Closed/nashorn/JDK_8034967.java starts failing (all platforms) since 9/154
authorvtewari
Wed, 12 Apr 2017 14:35:08 +0530
changeset 44794 4ad24a9cf021
parent 44793 086c71b7b1dd
child 44795 25c2ace97728
8177656: Closed/nashorn/JDK_8034967.java starts failing (all platforms) since 9/154 Reviewed-by: jlaskey
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java	Wed Apr 19 13:38:54 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java	Wed Apr 12 14:35:08 2017 +0530
@@ -114,7 +114,11 @@
             @Override
             public Class<?> loadClass(final String name, final boolean resolve) throws ClassNotFoundException {
                 try {
-                    Context.checkPackageAccess(name);
+                    final int i = name.lastIndexOf('.');
+                    if(i != -1){
+                        final String pkgName = name.substring(0,i);
+                        Context.checkPackageAccess(pkgName);
+                    }
                     return super.loadClass(name, resolve);
                 } catch (final SecurityException se) {
                     // we may be implementing an interface or extending a class that was