You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2020/04/23 20:41:32 UTC

[Bug 64373] New: tag-file reference from .tld in /WEB-INF/classes/META-INF cannot be resolved

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: karl@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 64373] tag-file reference from .tld in /WEB-INF/classes/META-INF cannot be resolved

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64373

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #2 from Mark Thomas <ma...@apache.org> ---
Many thanks for the report and the patch. Your analysis looks to be spot on to
me.

Fixed in:
- master for 10.0.0-M5 onwards
- 9.0.x for 9.0.35 onwards
- 8.5.x for 8.5.55 onwards

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 64373] tag-file reference from .tld in /WEB-INF/classes/META-INF cannot be resolved

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64373

--- Comment #3 from Karl von Randow <ka...@xk72.com> ---
That's fantastic, thank you very much Mark.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 64373] tag-file reference from .tld in /WEB-INF/classes/META-INF cannot be resolved

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64373

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
Looking at this now...

Yes, it is a spec requirement (JSP.8.4.1) that for tags packaged in a JAR the
path must always start with "/META-INF/tags/..."

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org