https://bz.apache.org/bugzilla/show_bug.cgi?id=58817

--- Comment #2 from Konstantin Kolinko <knst.koli...@gmail.com> ---
Observations
--------------
1. Comparing Mapper.internalMapWrapper() implementations between Tomcat 6 and
Tomcat 7, they are not very different.

The only substantial difference is a missing block of code in Tomcat 6 (-- the
code block just above "Rule 7". In Tomcat 7 it is commented as "/* welcome file
processing - take 2"),  but it does not matter for this bug. It fails earlier.

2. MapperListener implementations are quite different. In Tomcat 7 it is a
LifecycleListener, and has a reference to Context that is the cause of the
event.

In Tomcat 6 it is a NotificationListener and this feature is triggered by
unregistration of a JMX MBean. - See stacktrace attached in Description
(Comment 0) of this bug.

As NotificationListener in Tomcat 6 does not have a reference to Context, it
uses Mapper to get one, simulating a request with (host name = hostName, uri =
contextName).

For ROOT context the uri becomes "", and the failure happens.

3. A similar call to Mapper.map() is used in Tomcat 7 and later to implement
ApplicationContext.getContext(uri). There is a check in that method that
uri.startsWith("/"), so it does not use an empty URI.

Conclusion
-----------
- NotificationListener of Tomcat 6 is the only place in Tomcat 6/7/8/9 that
calls Mapper.map() with an empty string as URI. While it is possible to improve
Mapper, I think it is sufficient to add workaround to NotificationListener to
use a valid URI ("/") in this case.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Reply via email to