classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

currentClassLoader problem


From: David Holmes
Subject: currentClassLoader problem
Date: Mon, 15 Mar 2004 14:41:48 +1000

I'm having a lot of trouble trying to understand what needs to be done to
correctly set up class loaders in Classpath.

Present point of confusion is SecurityManager.currentClassLoader and its
helper VMSecurityManager.currentClassLoader.

The docs for SecurityManager.currentClassLoader states that it returns:

   ClassLoader of the first non-system class on the execution
   stack. A non-system class is one whose ClassLoader is not equal to
   address@hidden ClassLoader#getSystemClassLoader()} or its ancestors.

and it simply returns VMSecurityManager.currentClassLoader() *but* the docs
for VMSecurityManager.currentClassLoader state that it returns:

     This is the first non-null class loader
   * on the stack, if one exists, stopping either at the end of the stack
   * or the first instance of a PrivilegedAction. In other words, this call
   * automatically unwinds past all classes loaded by the bootstrap loader,
   * where getClassLoader() returns null, to get to the user class that
   * really invoked the call that needs a classloader.

These two descriptions do not match, so the delegation from SecurityManager
to VMSecurityManager is incorrect as the latter would return the
system/application classloader, while the former should not return that.
There seems to be confusion between the bootstrap loader (which is often
null) and the system/application loader (as returned by
getSystemClassLoader()) which is never null.

David Holmes





reply via email to

[Prev in Thread] Current Thread [Next in Thread]