https://bz.apache.org/bugzilla/show_bug.cgi?id=64373

            Bug ID: 64373
           Summary: tag-file reference from .tld in
                    /WEB-INF/classes/META-INF cannot be resolved
           Product: Tomcat 9
           Version: 9.0.34
          Hardware: PC
                OS: Mac OS X 10.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
          Assignee: dev@tomcat.apache.org
          Reporter: k...@xk72.com
  Target Milestone: -----

Created attachment 37195
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37195&action=edit
patch for TagLibraryInfoImpl

When the Jar Scanner is configured with scanAllDirectories, TldScanner will
load tag library descriptors in /WEB-INF/classes/META-INF/ (@see
TldScanner.TldScannerCallback#scanWebInfClasses)

When a .tld references a tag-file, it MUST reference it as
/META-INF/tags/blah.tag (attempting a relative path results in Illegal tag file
path..., I guess that's a spec requirement)

e.g. /WEB-INF/classes/META-INF/tags.tld

<?xml version="1.0" encoding="UTF-8"?>

<taglib xmlns="http://java.sun.com/xml/ns/j2ee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
web-jsptaglibrary_2_0.xsd"
        version="2.0">
        <tlib-version>1.0</tlib-version>
        <short-name>tags</short-name>
        <tag-file>
                <name>bug</name>
                <path>/META-INF/tags/bug.tag</path>
        </tag-file>
</taglib>


A .tld living in /WEB-INF/classes referencing a tag-file in /META-INF/tags
intends it to be loaded from /WEB-INF/classes/META-INF/tags in the same way
that a .tag living in a jar is loaded from /META-INF inside the jar.

HOWEVER the tag-file is instead loaded from /META-INF/tags at the root of the
webapp, which of course can't be found.

I think this should be resolved, as Tomcat appears to support .tlds in
/WEB-INF/classes/META-INF. I also _think_ the solution is quite simple (hey
sometimes it is!)...

TagLibraryInfoImpl#createTagFileInfo knows the path and whether it's in a jar
or not, so it can "correct" the path to have /WEB-INF/classes in front. I've
attached a patch for this change.

All the best,
Karl

-- 
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