commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 10825] - NullPointException when Logger.getClassLoader returns null
Date Thu, 18 Jul 2002 16:07:11 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10825>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10825

NullPointException when Logger.getClassLoader returns null





------- Additional Comments From rsitze@apache.org  2002-07-18 16:07 -------
Just to keep the conversation going :-)  I'm moving this side comment from Axis 
(because I don't think it is relevant there, it's not constrained as commons-
logging is):

>> [If JDK 1.1 has not getSystemClassLoader I have to assume it does not return 
null.]

Not true.

JDK 1.1.x: Class.getClassLoader() == null == SystemClassLoader
JDK 1.2+:  Class.getClassLoader() == null == BootstrapClassLoader

... now how do you get the system classloader in JDK 1.1.x?
... and how do you get the bootstrap classloader in JDK 1.2+?

I'm using the following class as my "SystemClassLoader" in Discovery:

    /**
     * JDK 1.1.x compatible?
     * There is no direct way to get the system class loader
     * in 1.1.x, so work around...
     */
    class SystemClassLoader extends ClassLoader {
        protected Class loadClass(String className, boolean resolve)
            throws ClassNotFoundException
        {
            return findSystemClass(className);
        }
        
        public URL getResource(String resName) {
            return getSystemResource(resName);
        }
        
        public InputStream getResourceAsStream(String resName) {
            return getSystemResourceAsStream(resName);
        }
    }

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message