ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 6606] - META-BUG problems with delegating classloaders
Date Wed, 06 Aug 2003 17:04:55 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=6606>.
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=6606

META-BUG problems with delegating classloaders





------- Additional Comments From tommy@tommysvensson.net  2003-08-06 17:04 -------
Since my bug report (22170) has been marked as a duplicate of this one, I guess
its better that I put my comment in this instead.

I think I might know what the problem is. Since reporting my bug I have made my
own ClassLoader for my project, and I got exactly the same exception as Ant
does! It complains that it cannot find "Path.class". What I didn't notice at
first was that the class it complains about not finding is not having any
package! In my case the Path class does belong to a package. But somewhere in my
code there is a 

  if (this.interfaceClass.getPackage() != null) ...

getPackage() did actually return null when this.interfaceClass had been loaded
by my class loader causing "Path.class" without a package to be looked for a bit
down using Class.forName(). This ofcourse failed with the ClassNotFoundException.

What I did was to add a call to definePackage(...) with the class package before
calling defineClass() in findClass(). When the class is then defined the package
 the class file refers to is also defined and the defined class can reference it.
After this fix my class loader works perfectly.

If I bring up AntClassLoader.java in my editor and do a find on "definePackage"
nothing is found! So AntClassLoader never calls definePackage()! That is the
source of my problem!

Best Regards, Tommy Svensson

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message