Index: java/org/apache/catalina/startup/LocalStrings.properties =================================================================== --- java/org/apache/catalina/startup/LocalStrings.properties (revision 1676249) +++ java/org/apache/catalina/startup/LocalStrings.properties (working copy) @@ -124,8 +124,11 @@ tldConfig.cce=Lifecycle event data object {0} is not a Context tldConfig.dirFail=Failed to process directory [{0}] for TLD files tldConfig.dirScan=Scanning for TLD files in directory [{0}] +tldConfig.noTldInDir=No TLD files were found in directory [{0}]. tldConfig.execute=Error processing TLD files for context with name [{0}] tldConfig.jarFail=Failed to process JAR [{0}] for TLD files +tldConfig.noTldInJar=No TLD files were found in [{0}]. Consider adding the JAR to the org.apache.catalina.startup.TldConfig.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file. +tldConfig.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. tldConfig.webinfFail=Failed to process TLD found at [{0}] tldConfig.webinfScan=Scanning WEB-INF for TLD files in [{0}] tldConfig.webxmlAdd=Adding path [{0}] for URI [{1}] Index: java/org/apache/catalina/startup/TldConfig.java =================================================================== --- java/org/apache/catalina/startup/TldConfig.java (revision 1676249) +++ java/org/apache/catalina/startup/TldConfig.java (working copy) @@ -266,10 +266,14 @@ // Stages 3b & 4 JarScanner jarScanner = context.getJarScanner(); + + TldJarScannerCallback objCallBack = new TldJarScannerCallback(); jarScanner.scan(context.getServletContext(), context.getLoader().getClassLoader(), - new TldJarScannerCallback(), noTldJars); - + objCallBack, noTldJars); + if(objCallBack.scanFoundNoTLDs()){ + log.info(sm.getString("tldConfig.noTldSummary")); + } // Now add all the listeners we found to the listeners for this context String list[] = getTldListeners(); @@ -290,10 +294,11 @@ } private class TldJarScannerCallback implements JarScannerCallback { - + boolean tldFound = false; + @Override public void scan(JarURLConnection urlConn) throws IOException { - tldScanJar(urlConn); + tldFound = tldScanJar(urlConn); } @Override @@ -300,9 +305,13 @@ public void scan(File file) { File metaInf = new File(file, "META-INF"); if (metaInf.isDirectory()) { - tldScanDir(metaInf); + tldFound = tldScanDir(metaInf); } } + + private boolean scanFoundNoTLDs() { + return !tldFound; + } } // -------------------------------------------------------- Private Methods @@ -432,8 +441,9 @@ * * Keep in sync with o.a.j.comiler.TldLocationsCache */ - private void tldScanDir(File start) { - + private boolean tldScanDir(File start) { + boolean isFound = false; + if (log.isTraceEnabled()) { log.trace(sm.getString("tldConfig.dirScan", start.getAbsolutePath())); } @@ -446,6 +456,7 @@ tldScanDir(fileList[i]); } else if (fileList[i].getAbsolutePath().endsWith(TLD_EXT)) { InputStream stream = null; + isFound = true; try { stream = new FileInputStream(fileList[i]); XmlErrorHandler handler = tldScanStream(stream); @@ -466,6 +477,12 @@ } } } + if(!isFound){ + if (log.isDebugEnabled()) { + log.debug(sm.getString("tldConfig.noTldInDir", start.getAbsolutePath())); + } + } + return isFound; } /* @@ -476,10 +493,11 @@ * * Keep in sync with o.a.j.comiler.TldLocationsCache */ - private void tldScanJar(JarURLConnection jarConn) { + private boolean tldScanJar(JarURLConnection jarConn) { Jar jar = null; InputStream is; + boolean isFound = false; try { jar = JarFactory.newInstance(jarConn.getURL()); @@ -489,6 +507,7 @@ while (entryName != null) { if (entryName.startsWith("META-INF/") && entryName.endsWith(".tld")) { + isFound = true; is = null; try { is = jar.getEntryInputStream(); @@ -507,6 +526,12 @@ jar.nextEntry(); entryName = jar.getEntryName(); } + if(!isFound){ + if (log.isDebugEnabled()) { + log.debug(sm.getString("tldConfig.noTldInJar", + jarConn.getURL().getFile())); + } + } } catch (IOException ioe) { log.warn(sm.getString("tldConfig.jarFail", jarConn.getURL()), ioe); } finally { @@ -514,6 +539,7 @@ jar.close(); } } + return isFound; }