Log JARs scanned for TLDs where no TLD is found.
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 19 Apr 2011 10:41:29 +0000 (10:41 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 19 Apr 2011 10:41:29 +0000 (10:41 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1095012 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/jasper/compiler/TldLocationsCache.java
java/org/apache/jasper/resources/LocalStrings.properties
webapps/docs/changelog.xml

index 580d567..a824016 100644 (file)
@@ -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));
+        }
     }
 
     /*
index 33121f8..f18fed0 100644 (file)
@@ -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
index 2dab80f..9907347 100644 (file)
         Correct a regression in the fix for <bug>49916</bug> that resulted in
         JSPs being compiled twice rather than just once. (markt)
       </fix>
+      <add>
+        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)
+      </add>
     </changelog>
   </subsection>
   <subsection name="Web applications">