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: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to