On 30/10/2014 00:33, Konstantin Kolinko wrote:
2014-10-29 17:42 GMT+03:00 <markt@apache.org>:
Author: markt
Date: Wed Oct 29 14:42:01 2014
New Revision: 1635154

URL: http://svn.apache.org/r1635154
URLs may be added directly to the web application's class path. ensure that they are scanned if a StandardJarScanner is configured to scan the class path.

tomcat/trunk/test/org/apache/tomcat/util/scan/TestStandardJarScanner.java (with props)
(It was a fix for

I suspect that this change is the trigger for breakage of
org.apache.jasper.servlet.TestTldScanner test.
I agree. I was looking at this last night and reached the same conclusion.
From memory, before the WebResource refactoring that simplified this
code there was a check that ensured that WEB-INF/classes and JARs from
WEB-INF/lib were excluded from the class path scan. I think that check
needs to be restored a) to address this issue and b) to make the scan
more efficient.
The logs are:


Caused by: java.lang.IllegalArgumentException: The resource path
[null/META-INF/bug55807.tld] is not valid
at org.apache.catalina.webresources.StandardRoot.validate(StandardRoot.java:250)
at org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:212)
at org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:206)
at org.apache.catalina.core.ApplicationContext.getResource(ApplicationContext.java:533)
at org.apache.catalina.core.ApplicationContextFacade.getResource(ApplicationContextFacade.java:199)
at org.apache.jasper.compiler.TldCache.getLastModified(TldCache.java:128)
at org.apache.jasper.compiler.TldCache.<init>(TldCache.java:70)
at org.apache.jasper.servlet.JasperInitializer.onStartup(JasperInitializer.java:113)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5185)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 7 more

I debugged with breakpoint at "TldResourcePath(URL url, String
webappPath, String entryName)" constructor (TldResourcePath: line 65)

It is called with the following arguments:
- url: file:/<...>trunk/test/webapp/WEB-INF/classes/META-INF/bug55807.tld
- webappPath: null/META-INF/bug55807.tld
- entryName: null

Stacktrace at constructor call:
Daemon Thread [localhost-startStop-1] (Suspended (breakpoint at line
65 in TldResourcePath))
owns: StandardContext (id=33)
TldResourcePath.<init>(URL, String, String) line: 65
TldResourcePath.<init>(URL, String) line: 54
BasicFileAttributes) line: 342
BasicFileAttributes) line: 1
FileTreeWalker.walk(Path, int, List<AncestorDirectory>) line: 135
FileTreeWalker.walk(Path, int, List<AncestorDirectory>) line: 199
FileTreeWalker.walk(Path) line: 69
Files.walkFileTree(Path, Set<FileVisitOption>, int,
FileVisitor<Path>) line: 2602
Files.walkFileTree(Path, FileVisitor<Path>) line: 2635
TldScanner$TldScannerCallback.scan(File, String, boolean) line: 323
StandardJarScanner.process(JarScanType, JarScannerCallback, URL,
String, boolean) line: 315
StandardJarScanner.scan(JarScanType, ServletContext,
JarScannerCallback) line: 227
TldScanner.scanJars() line: 240
TldScanner.scan() line: 99
JasperInitializer.onStartup(Set<Class<?>>, ServletContext) line: 103
StandardContext.startInternal() line: 5185
StandardContext(LifecycleBase).start() line: 150
ContainerBase$StartChild.call() line: 1409
ContainerBase$StartChild.call() line: 1
FutureTask<V>.run() line: 262
ThreadPoolExecutor.runWorker(ThreadPoolExecutor$Worker) line: 1145
ThreadPoolExecutor$Worker.run() line: 615
Thread.run() line: 745

Note the following lines in stacktrace:

TldScanner$TldScannerCallback.scan(File, String, boolean) line: 323
StandardJarScanner.process(JarScanType, JarScannerCallback, URL,
String, boolean) line: 315
StandardJarScanner.scan(JarScanType, ServletContext,
JarScannerCallback) line: 227

At StandardJarScanner line 227 it is:
process(scanType, callback, urls[i], null, isWebapp);

where "null" is explicitly passed as the value of "webappPath".
The "null" value is passed into StandardJarScanner.process() and
further into TldScanner$TldScannerCallback.scan(), see the above 3
lines of stacktrace.

TldScanner line 338:
String resourcePath = webappPath + "/" + subPath;

results in "null/" prefix.

Note 2: At that point in time when the above stacktrace etc. happens,
it is the second time when TldResourcePath() constructor is called for
bug55807.tld file.

At some earlier time TldResourcePath(URL url, String webappPath,
String entryName) is called with correct webappPath value,


I think that the second call with null//META-INF/bug55807.tld is a
result of this commit.

It may be that this bug did exist before, but that code path in
StandardJarScanner just was not executed.
That null doesn't look right. One of this morning's jobs is to look at that.


To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org

Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 4 | next ›
Discussion Overview
groupdev @
postedOct 29, '14 at 2:42p
activeOct 30, '14 at 10:29a

2 users in discussion

Mark Thomas: 3 posts Konstantin Kolinko: 1 post



site design / logo © 2018 Grokbase