Author: markt
Date: Mon May 11 09:25:01 2015
New Revision: 1678701
URL: http://svn.apache.org/r1678701
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=56438
Add debug logging for TLD found/not-found in JARs, resource paths and
directories.
Based on a patch by VIN.
Modified:
tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties
tomcat/trunk/java/org/apache/jasper/servlet/TldScanner.java
Modified: tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties?rev=1678701&r1=1678700&r2=1678701&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties
(original)
+++ tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties Mon
May 11 09:25:01 2015
@@ -389,7 +389,12 @@ jsp.message.jsp_unload_check=Checking JS
xmlParser.skipBomFail=Failed to skip BOM when parsing XML input stream
+jsp.tldCache.noTldInResourcePath=No TLD files were found in resource path
[{0}].
+jsp.tldCache.tldInResourcePath=TLD files were found in resource path [{0}].
+jsp.tldCache.noTldInDir=No TLD files were found in directory [{0}].
+jsp.tldCache.tldInDir=TLD files were found in directory [{0}].
jsp.tldCache.noTldInJar=No TLD files were found in [{0}]. Consider adding the
JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in
CATALINA_BASE/conf/catalina.properties file.
+jsp.tldCache.tldInJar=TLD files were found in JAR [{0}].
jsp.tldCache.noTldSummary=At least one JAR was scanned for TLDs yet contained
no TLDs. Enable debug logging for this logger for a complete list of JARs that
were scanned but no TLDs were found in them. Skipping unneeded JARs during
scanning can improve startup time and JSP compilation time.
#ELInterpreter
Modified: tomcat/trunk/java/org/apache/jasper/servlet/TldScanner.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/servlet/TldScanner.java?rev=1678701&r1=1678700&r2=1678701&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/servlet/TldScanner.java (original)
+++ tomcat/trunk/java/org/apache/jasper/servlet/TldScanner.java Mon May 11
09:25:01 2015
@@ -220,6 +220,7 @@ public class TldScanner {
protected void scanResourcePaths(String startPath)
throws IOException, SAXException {
+ boolean found = false;
Set<String> dirList = context.getResourcePaths(startPath);
if (dirList != null) {
for (String path : dirList) {
@@ -232,13 +233,24 @@ public class TldScanner {
} else if (path.startsWith("/WEB-INF/tags/")) {
// JSP 7.3.1: in /WEB-INF/tags only consider implicit.tld
if (path.endsWith("/implicit.tld")) {
+ found = true;
parseTld(path);
}
} else if (path.endsWith(TLD_EXT)) {
+ found = true;
parseTld(path);
}
}
}
+ if (found) {
+ if (log.isDebugEnabled()) {
+
log.debug(Localizer.getMessage("jsp.tldCache.tldInResourcePath", startPath));
+ }
+ } else {
+ if (log.isDebugEnabled()) {
+
log.debug(Localizer.getMessage("jsp.tldCache.noTldInResourcePath", startPath));
+ }
+ }
}
/**
@@ -279,6 +291,7 @@ public class TldScanner {
class TldScannerCallback implements JarScannerCallback {
private boolean foundJarWithoutTld = false;
+ private boolean foundFileWithoutTld = false;
@Override
public void scan(JarURLConnection urlConn, String webappPath,
@@ -305,11 +318,14 @@ public class TldScanner {
}
}
}
- if (!found) {
+ if (found) {
+ if (log.isDebugEnabled()) {
+ log.debug(Localizer.getMessage("jsp.tldCache.tldInJar",
jarURL.toString()));
+ }
+ } else {
foundJarWithoutTld = true;
if (log.isDebugEnabled()) {
- log.debug(Localizer.getMessage("jsp.tldCache.noTldInJar",
- jarURL.toString()));
+ log.debug(Localizer.getMessage("jsp.tldCache.noTldInJar",
jarURL.toString()));
}
}
}
@@ -321,6 +337,7 @@ public class TldScanner {
if (!metaInf.isDirectory()) {
return;
}
+ foundFileWithoutTld = false;
final Path filePath = file.toPath();
Files.walkFileTree(metaInf.toPath(), new SimpleFileVisitor<Path>()
{
@Override
@@ -332,6 +349,7 @@ public class TldScanner {
return FileVisitResult.CONTINUE;
}
+ foundFileWithoutTld = true;
String resourcePath;
if (webappPath == null) {
resourcePath = null;
@@ -354,6 +372,17 @@ public class TldScanner {
return FileVisitResult.CONTINUE;
}
});
+ if (foundFileWithoutTld) {
+ if (log.isDebugEnabled()) {
+ log.debug(Localizer.getMessage("jsp.tldCache.tldInDir",
+ file.getAbsolutePath()));
+ }
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug(Localizer.getMessage("jsp.tldCache.noTldInDir",
+ file.getAbsolutePath()));
+ }
+ }
}
@Override
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]