Bug 57723 - An incomplete fix for invalid context paths in StandardContext.java / JNDI fails
Summary: An incomplete fix for invalid context paths in StandardContext.java / JNDI fails
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 7.0.59
Hardware: PC All
: P2 minor (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-18 04:49 UTC by Christian Kahlo
Modified: 2015-03-19 14:29 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Kahlo 2015-03-18 04:49:24 UTC
The fix for #57216 is aimed handle invalid context paths, such as "/".
When using Tomcat.addWebapp() the (wrong) name for the context is
already set in Line 534.

    public Context addWebapp(Host host, String url, String path) {
        return addWebapp(host, url, url, path);
    }
			
    public Context addWebapp(Host host, String url, String name, String path) {
        silence(host, url);
        Context ctx = createContext(host, url);
        ctx.setName(name);
        ctx.setPath(url);
        ctx.setDocBase(path);
...

Therefore StandardContext.setPath()#2198 does not set the corrected name for the
context.

This causes JNDI to fail, i.e. in JSPCompilationContext.getLastModified()#410 and
#421.

if(invalid) should also include setting the new corrected name.
Or fail hard - that would have made it easier to find.

Best regards,
Christian
Comment 1 Mark Thomas 2015-03-19 14:29:22 UTC
Fixed in 7.0.x for 7.0.60 onwards.