tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 25088] New: - WebappClassLoader.getResource returns wrong location
Date Sat, 29 Nov 2003 18:46:44 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=25088>.
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=25088

WebappClassLoader.getResource returns wrong location

           Summary: WebappClassLoader.getResource returns wrong location
           Product: Tomcat 5
           Version: 5.0.14
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: olsok@pegasystems.com


If ClassLoader.getResource() is called specifying a .class file that is located 
within a jar file, the Tomcat5 WebappClassLoader will return a URL pointing to 
a work directory which may not exist and which will never contain the requested 
class file.

There is a comment in the method that says "copy binary content to work 
directory if not present", but there is no copying done -- nor should there be 
for .class files. findResourceInternal() has already copied all non-class 
content from the jar file into the work directory (when the first request for a 
non-class resource within a given jar is resolved).

getResource() needs to examine the name of the resource and avoid modifying the 
URL returned if the resource is a .class file (for consistency with logic in 
findResourceInternal().

The current behavior is inconsistent with previous versions of Tomcat and the 
JDK classloaders. My application relies on the ability to retrieve a URL for 
a .class resource in order to construct a classpath to be used with a Java 
compiler when compiling dynamically generated Java.

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


Mime
View raw message