W3C home > Mailing lists > Public > www-jigsaw@w3.org > January to February 1999

Re: JDK 1.2 classloader bug!

From: Yves Lafon <ylafon@w3.org>
Date: Wed, 20 Jan 1999 14:29:27 +0100 (MET)
To: Wolfgang Platzer <Wolfgang.Platzer@iaik.tu-graz.ac.at>
cc: Jigsaw Mailinglist <www-jigsaw@w3.org>
Message-ID: <Pine.GSO.4.05.9901201423560.18695-100000@tarantula.inria.fr>
On Wed, 20 Jan 1999, Wolfgang Platzer wrote:

> 
> I think I encountered the NT JDK 1.2 classloader bug within my application.
> Can someone point me to additional information or can tell me a workaround?

    // This is a nasty kludge due to a bug in jdk1.2 on NT
    // this.cls = Class.forName(clsname, true,
    //                          this.getClass().getClassLoader());
    // works and not
    // this.cls    = Class.forName(clsname);
    // even if it is exactly the same thing :)
    // and the creation of a new object is enough to make it run...
   this.cls.newInstance();

In fact the culprit  is the native method
ClassLoader.getCallerClassLoader(); 
It doesn't work as this.getClass().getClassLoader();
The workaround  ( this.cls.newInstance(); ) work for an unknown reason!
(thanks to Thomas Kopp for this workaround that keeps jdk1.1
compatibility)
Regards,

      /\          - Yves Lafon - World Wide Web Consortium - 
  /\ /  \        Architecture Domain - Jigsaw Activity Leader
 /  \    \/\    
/    \   /  \   http://www.w3.org/People/Lafon - ylafon@w3.org    
Received on Wednesday, 20 January 1999 08:29:45 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:28 GMT