[kaffe] Resource names starting with '/'

Dalibor Topic robilad@yahoo.com
Mon, 12 Aug 2002 14:15:25 -0700 (PDT)


--0-1722021651-1029186925=:50877
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hallo Helmer,
--- Helmer Krämer <hkraemer@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
--0-1722021651-1029186925=:50877
Content-Type: application/octet-stream; name="find_resources.diff"
Content-Transfer-Encoding: base64
Content-Description: find_resources.diff
Content-Disposition: attachment; filename="find_resources.diff"

LS0tIC9ob21lL3RvcGljL0NWUy9rYWZmZS9saWJyYXJpZXMvamF2YWxpYi9r
YWZmZS9sYW5nL1N5c3RlbUNsYXNzTG9hZGVyLmphdmEJTW9uIEp1bCAyOSAy
Mzo0ODo1NiAyMDAyCisrKyBsaWJyYXJpZXMvamF2YWxpYi9rYWZmZS9sYW5n
L1N5c3RlbUNsYXNzTG9hZGVyLmphdmEJTW9uIEF1ZyAxMiAyMjozMzowNiAy
MDAyCkBAIC04MSw2ICs4MSwxMCBAQAogCVN0cmluZ1Rva2VuaXplciB0ID0g
bmV3IFN0cmluZ1Rva2VuaXplcihjbGFzc3BhdGgsIHBhdGhTZXApOwogCVZl
Y3RvciB2ID0gbmV3IFZlY3RvcigpOwogCisJaWYgKG5hbWUuc3RhcnRzV2l0
aCgiLyIpKSB7CisJICAgIG5hbWUgPSBuYW1lLnN1YnN0cmluZygxKTsKKwl9
CisKIAl3aGlsZSAodC5oYXNNb3JlVG9rZW5zKCkpIHsKIAkJRmlsZSBmaWxl
ID0gbmV3IEZpbGUodC5uZXh0VG9rZW4oKSk7CiAK

--0-1722021651-1029186925=:50877
Content-Type: application/octet-stream; name=ChangeLog
Content-Transfer-Encoding: base64
Content-Description: ChangeLog
Content-Disposition: attachment; filename=ChangeLog

CSogbGlicmFyaWVzL2phdmFsaWIva2FmZmUvbGFuZy9TeXN0ZW1DbGFzc0xv
YWRlci5qYXZhOgoJKGZpbmRSZXNvdXJjZXMpIHJlbW92ZSBldmVudHVhbCBs
ZWFkaW5nIHNsYXNoIGJlZm9yZSB1c2luZwoJcmVzb3VyY2UgbmFtZS4KCVJl
cG9ydGVkIGJ5IEhlbG1lciBLcuRtZXIgPGhrcmFlbWVyQGZyZWVuZXQuZGU+
Cg==

--0-1722021651-1029186925=:50877--