TOMEE-2102: IvmContext bind/unbind creates duplicate contexts

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

TOMEE-2102: IvmContext bind/unbind creates duplicate contexts

Svetlin Zarev

While i was trying to simplify my IvmTests I stubmbled on another bug in
IvmContext - thi stime in bind()/unbind(). The issue is simple -> if
bind()-ing from a "relative" node (for instance lets have "a/b/c", and you
try to do b.bind(x, obj) instead of root.bind("a/b/x", obj)), bind() binds
the object in less/grtr tree, while if you bind with absolute path from the
root object, it binds in subTree-> letss/grtr. Hence it's possible to bind
two objects to the very same JNDI name !

I've created several junit tests that reproduce the issue. The fix is
simple -> we have to preprend the name of the current name node to the name
passed to bind()/unbind(). Actually that's exactly what lookup() is doing
at the moment.

I'll commit the proposed fix to my PR, as it currently contains only the

Also I want to challenge several of the existing tests as they are adopted
to the current behavior so they can just pass, for instance ->
IvmContextTest::rebind() has a typo so instead of rebinding it tries to
bind twice to the same jndi name and due to the bug  instead of failing as
required by the spec it passses.

@Jonathan - may you give more info on the issues you are having ? I'd be
happy to help with the IvmContexts.

Kind regards,