https://issues.apache.org/bugzilla/show_bug.cgi?id=48050
Summary: org.apache.naming.NamingContext's createSubcontext method returns Context with wrong name Product: Tomcat 6 Version: 6.0.20 Platform: PC OS/Version: Linux Status: NEW Severity: critical Priority: P2 Component: Catalina AssignedTo: dev@tomcat.apache.org ReportedBy: qingyang...@qunar.com Below is the original source code of org.apache.naming.NamingContext's createSubcontext(Name name) method: /** * Creates and binds a new context. Creates a new context with the given * name and binds it in the target context (that named by all but * terminal atomic component of the name). All intermediate contexts and * the target context must already exist. * * @param name the name of the context to create; may not be empty * @return the newly created context * @exception NameAlreadyBoundException if name is already bound * @exception InvalidAttributesException if creation of the subcontext * requires specification of mandatory attributes * @exception NamingException if a naming exception is encountered */ public Context createSubcontext(Name name) throws NamingException { checkWritable(); Context newContext = new NamingContext(env, this.name); bind(name, newContext); return newContext; } However, the returned NamingContext has the same name with its parent NamingContext. I suggest change the source code to below: public Context createSubcontext(Name name) throws NamingException { checkWritable(); Context newContext = new NamingContext(env, name.get(name.size() - 1)); bind(name, newContext); return newContext; } -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- 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