ASF Bugzilla – Attachment 32694 Details for
Bug 56438
If jar scan does not find context config or TLD config, log a message
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Fix for TLD scan in Tomcat7.0
56438_fix.diff (text/plain), 5.35 KB, created by
VIN
on 2015-04-28 09:22:44 UTC
(
hide
)
Description:
Fix for TLD scan in Tomcat7.0
Filename:
MIME Type:
Creator:
VIN
Created:
2015-04-28 09:22:44 UTC
Size:
5.35 KB
patch
obsolete
>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; > } > >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 56438
:
32639
| 32694 |
32702
|
32719
|
32720
|
32746
|
32747
|
32748