This is an exported version of the JIRA issue tracker. Please use the Google Code site to open new tickets or report updates to these existing tickets. Feel free to contact the mailing list with any questions.

[SJN-58] Unable to create subcontexts
Created: Wed, 1 Jun 2005 22:07:56 -0700 (PDT)  Updated: Wed, 6 Jun 2007 08:45:06 -0700 (PDT)

Status:Closed
Project:Simple-JNDI
Component/s:
Affects Version/s:
Fix Version/s:0.11

Type:BugPriority: Major
Reporter:Henri YandellAssignee:Robert M. Zigweid
Resolution:Fixed 
Environment:


 Description   
The new GenericContext seems to have a problem with subcontexts. From email to Robert a while back:

****
If I were to do:

Context tmp = ctxt.createSubcontext("path");
tmp = tmp.createSubcontext("one");
tmp = tmp.createSubcontext("two");

It gives me a NotContextException in getNameParser.

=============

I think the problem is in the method getNameParse(Name);NameParser (line 623 of AbstractContext).

For a hierarchy of 'path/one/two' when creating the 'two' subcontext, that method is given a Name of 'path/one'. It
then attempts to find the name in the subcontext, which it won't be. It needs to somehow talk to the parent subcontext,
and it needs to pass in "one" and not "path" as it currently is (getPrefix(1) should become getSuffix(name.size()-1)).

Also, in GenericContext, in createSubcontext(Name);Context, line 142, I think there should be a bind(name, newContext)
after line 150.

I'll commit my failing unit test.
****************

The unit test was committed and currently fails.

Comment by tigran [ Thu, 2 Jun 2005 03:49:06 -0700 (PDT) ]
Fixed the NameParser lookup.

r1727
Comment by bayard [ Thu, 29 Sep 2005 11:48:02 -0700 (PDT) ]
Done