Bugs item #993090, was opened at 2004-07-18 09:45
Message generated for change (Comment added) made by chiba
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=993090&group_id=22866

Category: Javassist
Group: CVS HEAD
Status: Open
Resolution: None
Priority: 5
Submitted By: Brett Randall (brett_s_r)
Assigned to: Shigeru Chiba (chiba)
Summary: Loader#findClass should throw ClassNotFoundException

Initial Comment:
A normal part of the contract of ClassLoader#findClass 
is that it should throw ClassNotFoundException if there 
is a problem locating the Class to be loaded.

javassist.Loader#findClass does not throw this 
Exception, which prevents subclasses from throwing it.  
It also silently catches all Exception-s rather than 
throwing ClassNotFoundException.

Proposed patch attached.


----------------------------------------------------------------------

>Comment By: Shigeru Chiba (chiba)
Date: 2004-07-19 22:55

Message:
Logged In: YES 
user_id=388745

Yes, the normal contract of ClassLoader#findClass requires
a subclass to throw a ClassNotFoundException.  However,
Javassist has already broken the contract of 
ClassLoader#loadClass on purpose!  That is, javassist.Loader
overrides loadClass although it is not recommended by the
contract of ClassLoader.

So, in javassist.Loader, it is not an exception or a problem
that the loader cannot find a class.  This is why it returns
null in that case.  Yes, I can modify the findClass as you
recommend.  However, that would be a (very small)
performance penalty since loadClass will frequently catch
an exception thrown by findClass.

Maybe, javassist.Loader#findClass should return null if it
cannot find a class but throw an exception if it gets some
problem (i.e. I/O error).

What do you think of this?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=993090&group_id=22866


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to