You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2024/03/13 11:22:07 UTC
(tomcat) branch 8.5.x updated: Correctly handle tag libraries packaged in JARs in a WAR deployment
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push:
new 0675222e36 Correctly handle tag libraries packaged in JARs in a WAR deployment
0675222e36 is described below
commit 0675222e36129a1b49449add1e6418877affdce1
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Mar 13 11:18:27 2024 +0000
Correctly handle tag libraries packaged in JARs in a WAR deployment
This fixes a JSP TCK test. It is likely a long standing bug but wasn't
detected as, prior to Jakarta EE 11, the TCK provided web applications
were unpacked prior to test execution.
---
java/org/apache/jasper/compiler/TagLibraryInfoImpl.java | 8 ++++++++
res/checkstyle/org-import-control.xml | 1 +
webapps/docs/changelog.xml | 5 +++++
3 files changed, 14 insertions(+)
diff --git a/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java b/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java
index fbad12e42e..acf3ee07e4 100644
--- a/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java
+++ b/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java
@@ -45,6 +45,7 @@ import javax.servlet.jsp.tagext.ValidationMessage;
import org.apache.jasper.JasperException;
import org.apache.jasper.JspCompilationContext;
import org.apache.tomcat.Jar;
+import org.apache.tomcat.util.buf.UriUtil;
import org.apache.tomcat.util.descriptor.tld.TagFileXml;
import org.apache.tomcat.util.descriptor.tld.TagXml;
import org.apache.tomcat.util.descriptor.tld.TaglibXml;
@@ -268,6 +269,13 @@ class TagLibraryInfoImpl extends TagLibraryInfo implements TagConstants {
URL url = null;
try {
url = ctxt.getResource(uri);
+ /*
+ * When the TLD cache is built for a TLD contained within a JAR within a WAR, the jar form of the URL is
+ * used for any nested JAR.
+ */
+ if (url.getProtocol().equals("war") && uri.endsWith(".jar")) {
+ url = UriUtil.warToJar(url);
+ }
} catch (Exception ex) {
err.jspError("jsp.error.tld.unable_to_get_jar", uri, ex.toString());
}
diff --git a/res/checkstyle/org-import-control.xml b/res/checkstyle/org-import-control.xml
index 9b4b6d0677..637d753193 100644
--- a/res/checkstyle/org-import-control.xml
+++ b/res/checkstyle/org-import-control.xml
@@ -102,6 +102,7 @@
<allow pkg="org.apache.jasper"/>
<allow pkg="org.apache.juli"/>
<allow pkg="org.apache.tomcat" exact-match="true"/>
+ <allow pkg="org.apache.tomcat.util.buf"/>
<allow pkg="org.apache.tomcat.util.descriptor"/>
<allow pkg="org.apache.tomcat.util.scan"/>
<allow pkg="org.apache.tomcat.util.security"/>
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 0737d6d24f..bf466d1113 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -167,6 +167,11 @@
<code>IllegalStateException</code> on code paths where there was a
subsequent attempt to obtain a <code>Writer</code>. (markt)
</fix>
+ <fix>
+ Correctly handle the case where a tag library is packaged in a JAR file
+ and the web application is deployed as a WAR file rather than an
+ unpacked directory. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Other">
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org