https://issues.apache.org/bugzilla/show_bug.cgi?id=57574

--- Comment #2 from Konstantin Kolinko <knst.koli...@gmail.com> ---
This is some error-handling path in case if Package.getPackage(name) returned
null. Is there a valid reason for getPackage() method to return null? From the
comment in the code it looks that there is.

> String path = name.replace('.', '/');
> URL url = cl.getResource(path);

I think that both approaches (with and without terminating '/') are invalid.

I see no saying in ClassLoader.getResource() javadoc that this operation is
applicable to directories.  The support of ending '/' may be dependent on the
underlying file system. I.e.:

- I think a file system is likely to behave independently of the trailing
slash.

- I think a JAR is likely to expect a trailing '/' if it was packed with
explicit archive entries for directories. If there are no such entries in the
archive then it is likely to return false 'null' answers.


I propose to postpone the check until one actually tries to locate the class.
It is for performance's sake, like it is already done with
ImportHandler.importClass() method.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to