8144979: Context.fromClass should catch exception from Class.getClassLoader call
szegedia at gmail.com
Wed Dec 9 08:38:31 UTC 2015
So… I presume the security exception only thrown when a SecurityManager is
present? This is actually somewhat weird, especially since VM anonymous
classes should return their host class' loader as their loader.
getClassLoader() doc says
If a security manager is present, and the caller's class loader is not null
> and the caller's class loader is not the same as or an ancestor of the
> class loader for the class whose class loader is requested, then this
> method calls the security manager's checkPermission method with a
> RuntimePermission("getClassLoader") permission
I'd think that for Context.class.classLoader it is true that it is either
null or the ancestor of the script's class loader, is that not so? I'm just
trying to understand *why* can this SecurityException arise at all.
On Wed, Dec 9, 2015 at 9:20 AM, Michael Haupt <michael.haupt at oracle.com>
> Hi Sundar,
> lower-case thumbs up.
> One remark: I'm a bit concerned about the plethora of files involved with
> the dynalink samples. For each particular sample, there's a Java file, a
> sample JS file, and a linker JS file, where the linker compiles the Java
> file and assembles a JAR. The linkers all look pretty much the same. In my
> opinion, providing one script that takes care of compilation and JARring
> and is loaded from all actual samples would keep the samples more lean.
> > Am 09.12.2015 um 08:56 schrieb Sundararajan Athijegannathan <
> sundararajan.athijegannathan at oracle.com>:
> > Please review http://cr.openjdk.java.net/~sundar/8144979/ for
> > This fix is already in jake/nashorn. See also:
> > In addition, I've moved all dynalink samples to
> $nashorn/samples/dynalink directory and renamed the README.
> > Thanks,
> > -Sundar
> Dr. Michael Haupt | Principal Member of Technical Staff
> Phone: +49 331 200 7277 | Fax: +49 331 200 7561
> Oracle Java Platform Group | LangTools Team | Nashorn
> Oracle Deutschland B.V. & Co. KG, Schiffbauergasse 14 | 14467 Potsdam,
> <http://www.oracle.com/commitment> Oracle is committed to developing
> practices and products that help protect the environment
More information about the nashorn-dev