tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 48737] New: JspCompilationContext assumes that tagfile with a path starting with META-INF are in jars without checking
Date Sat, 13 Feb 2010 18:19:06 GMT

           Summary: JspCompilationContext assumes that tagfile with a path
                    starting with META-INF are in jars without checking
           Product: Tomcat 6
           Version: 6.0.24
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper

Created an attachment (id=24978)
 --> (
patch to JspCompilationContext

This is a pretty special case, since tagfiles in META-INF are usually in jar
but when using a custom dircontext implementation (usually during development
in order to load files from the filesystem without building a full jar) it may
happen that the path given to jasper starts with META-INF also if the file is
not in a jar. This is what happens using the Eclipse WTP tomcat loader, which
loads classes from the workspaces and tld/tagfiles from directories inside your

Tagfiles contained in META-INF directories worked properly till tomcat 6.0.17,
but the final fix for BUG 43741 broke it (I am still using 6.0.16 and not
upgrading due to this problem).

Looking at JspCompilationContext.getResource() the patch to solve this problem
would be very simple and "safe": if the path starts with META-INF and a jar
file containing the tld doesn't exist the resulting URL is simply null.
Adding a check for the null jar and setting the URL to the "standard" path
inside the context fixes the problem and everything starts working again (note
that this doesn't break the previous fix and it can't cause any problem, since
the result would have been null anyway).

A patch against trunk (2010-02-13) is attached, the following code should
easily displays what the patch does: 

        URL result = null;
        if (res.startsWith("/META-INF/")) {
           // some lines to get the jar url
           // ...
           if (jarUrl != null) {
               result = new URL(jarUrl.toExternalForm() + res.substring(1));
+          else {
+              // the path starts with /META-INF but the file is not in a jar
+              result = context.getResource(canonicalURI(res));
+          }

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

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message