[kaffe] Resource names starting with '/'

Dalibor Topic robilad at yahoo.com
Mon Aug 12 14:15:25 PDT 2002


Hallo Helmer,
--- Helmer Krämer <hkraemer at freenet.de> wrote:
> while trying to run Tomcat 3.2.4 with current cvs, I
> found out
> that Class.getResource fails to load resources whose
> names start
> with a '/'.  Other VMs load these resources just
> fine.

Thanks for your bug report, and sorry about the delay.

I verified that it was me who commited the change in
question (see
http://www.kaffe.org/cgi-bin/viewcvs.cgi/kaffe/libraries/javalib/java/lang/Class.java.diff?r1=1.32&r2=1.33
) I checked the latest version of the spec and it says
that :

"This method delegates the call to its class loader,
after making these changes to the resource name: if
the resource name starts with "/", it is unchanged;
otherwise, the package name is prepended to the
resource name after converting "." to "/". If this
object was loaded by the bootstrap loader, the call is
delegated to ClassLoader.getSystemResource."

(see
http://java.sun.com/j2se/1.4/docs/api/java/lang/Class.html#getResource(java.lang.String)
)


> The problem seems to be that Class.fullResourceName
> does not
> remove the leading slash. Since this was changed not
> too long
> ago, I wonder if there's something else going wrong?

I interpret the spec in the way that it's up to the
actual class loader implementation to remove the
leading '/'. I've attached a patch that allows to use
resource names as in        
Class.class.getResource("/java/lang/Class.class")
again. Could you give it a try and tell me if it fixes
the problem you are experiencing?

best regards,

dalibor topic


__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: find_resources.diff
Type: application/octet-stream
Size: 435 bytes
Desc: find_resources.diff
Url : http://kaffe.org/pipermail/kaffe/attachments/20020812/d5d548e2/attachment-0006.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ChangeLog
Type: application/octet-stream
Size: 181 bytes
Desc: ChangeLog
Url : http://kaffe.org/pipermail/kaffe/attachments/20020812/d5d548e2/attachment-0007.obj 


More information about the kaffe mailing list