Bugs item #459387, was opened at 2001-09-06 18:47
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=376685&aid=459387&group_id=22866

Category: None
Group: v2.4 (stable)
Status: Open
Resolution: None
Priority: 5
Submitted By: Erin Mulder (meara)
Assigned to: Nobody/Anonymous (nobody)
Summary: Creating new subcontext overwrites old

Initial Comment:
Summary:

Calling Context.createSubcontext("foo") seems to 
destroy the context previously bound to that name 
instead of throwing a NameAlreadyBoundException.  

(Reproducible in at least the jboss-2.2.2-tomcat-3.2.2 
and jboss-2.4.0-tomcat-3.2.3 bundles)


Details:

The code I'm looking at has an MBean that registers a 
bunch of entries at startup in the following manner:

    Context ctx = new InitialContext();
    Context fooCtx = ctx.createSubcontext("foo");
    Context barCtx = fooCtx.createSubcontext("one");
    barCtx.bind(string1, value1);
    barCtx.bind(string2, value2);
    ...

There is also an EJB which binds an object in this way:

    Context ctx = new InitialContext();
    try {
       ctx.createSubcontext("foo");
    } catch( NameAlreadyBoundException ne ) {
       ne.printStackTrace();
    }
    try {
       ctx.createSubcontext("foo/two");
    } catch( NameAlreadyBoundException ne ) { 
       ne.printStackTrace();
    }
    
    ctx.rebind("foo/two/Date", viewDate);
    ctx.rebind("foo/two/Calendar", viewCalendar);


After startup, all of the entries registered 
under "foo/one" by the MBean are there.  After calling 
the EJB date-setter, foo has a "two" with the correct 
children, but "one" and its children no longer exist.  
No exception is triggered.

(An obvious workaround is to reverse the logic and 
expect a NameNotFoundException if the name is not 
bound -- probably more efficient anyway)

Still, the behavior described above is contrary to the 
API which states that a NameAlreadyBoundException 
should be thrown.





 


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=376685&aid=459387&group_id=22866

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to