From db9004dbeef4889c4a17090519de1835bdf28455 Mon Sep 17 00:00:00 2001 From: markt Date: Tue, 19 Apr 2011 10:41:29 +0000 Subject: [PATCH] Log JARs scanned for TLDs where no TLD is found. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1095012 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/jasper/compiler/TldLocationsCache.java | 10 ++++++++++ java/org/apache/jasper/resources/LocalStrings.properties | 2 ++ webapps/docs/changelog.xml | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/java/org/apache/jasper/compiler/TldLocationsCache.java b/java/org/apache/jasper/compiler/TldLocationsCache.java index 580d567a6..a824016c0 100644 --- a/java/org/apache/jasper/compiler/TldLocationsCache.java +++ b/java/org/apache/jasper/compiler/TldLocationsCache.java @@ -37,6 +37,8 @@ import org.apache.jasper.JasperException; import org.apache.jasper.util.ExceptionUtils; import org.apache.jasper.xmlparser.ParserUtils; import org.apache.jasper.xmlparser.TreeNode; +import org.apache.juli.logging.Log; +import org.apache.juli.logging.LogFactory; import org.apache.tomcat.JarScanner; import org.apache.tomcat.JarScannerCallback; @@ -75,6 +77,8 @@ import org.apache.tomcat.JarScannerCallback; public class TldLocationsCache { + private final Log log = LogFactory.getLog(TldLocationsCache.class); + /** * The types of URI one may specify for a tag library */ @@ -376,6 +380,7 @@ public class TldLocationsCache { JarFile jarFile = null; String resourcePath = conn.getJarFileURL().toString(); + boolean foundTld = false; try { conn.setUseCaches(false); jarFile = conn.getJarFile(); @@ -385,6 +390,7 @@ public class TldLocationsCache { String name = entry.getName(); if (!name.startsWith("META-INF/")) continue; if (!name.endsWith(".tld")) continue; + foundTld = true; InputStream stream = jarFile.getInputStream(entry); tldScanStream(resourcePath, name, stream); } @@ -397,6 +403,10 @@ public class TldLocationsCache { } } } + if (!foundTld) { + log.info(Localizer.getMessage("jsp.tldCache.noTldInJar", + resourcePath)); + } } /* diff --git a/java/org/apache/jasper/resources/LocalStrings.properties b/java/org/apache/jasper/resources/LocalStrings.properties index 33121f8a4..f18fed0c0 100644 --- a/java/org/apache/jasper/resources/LocalStrings.properties +++ b/java/org/apache/jasper/resources/LocalStrings.properties @@ -487,3 +487,5 @@ jsp.message.jsp_removed_idle=Removing idle JSP for path [{0}] in context [{1}] a jsp.message.jsp_unload_check=Checking JSPs for unload in context [{0}], JSP count: {1} queue length: {2} xmlParser.skipBomFail=Failed to skip BOM when parsing XML input stream + +jsp.tldCache.noTldInJar=No TLD files were found in [{0}]. Consider adding the JAR to to the tomcat.util.scan.DefaultJarScanner.jarsToSkip in CATALINA_BASE/catalina.properties \ No newline at end of file diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 2dab80f70..9907347bc 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -111,6 +111,11 @@ Correct a regression in the fix for 49916 that resulted in JSPs being compiled twice rather than just once. (markt) + + Log JARs that are scanned for TLDs where no TLD is found so that users + can easily identify JARs that can be added to the list of JARs to skip. + (markt) + -- 2.11.0