Svetlin Zarev created TOMEE-2102:
------------------------------------

             Summary: IvmContext bind/unbind creates duplicate contexts
                 Key: TOMEE-2102
                 URL: https://issues.apache.org/jira/browse/TOMEE-2102
             Project: TomEE
          Issue Type: Bug
            Reporter: Svetlin Zarev


Imagine you have the flowing context "a/b/object". The context tree can be 
created in two ways:

1. Relative to the root or some
{code} 
IvmContext root = IvmContext.createRootContext();
root.bind("a/b/object", new Object);
{code}

2. Relative to some node:
IvmContext root = IvmContext.createRootContext();
root.bind("a", null);

IvmContext a = root.lookup("a");
a.bind("b", null);

IvmContext b = root.lookup("b")
a.bind("object", new Object())
{code}

So when one looks up "object" or "a" or "b" or object, one has to get the very 
same result regardless if the context tree was created by 1 or by 2. Yet this 
is not the case when it comes to the IvmContext. Maybe the most obvious (and 
shocking) issue is that IvmContext allows to bind 2 different objects to the 
same name ! Example:

{code}
       IvmContext root = IvmContext.createRootContext();
        root.bind("a/b/object", new Object());

        IvmContext b = (IvmContext) root.lookup("a/b");
        //already bound from root -> must fail, yet it does not
        b.bind("object", new Object());
{code}

I've provided various test cases for different combinations of 
bind/unbind/lookup that reproduce the issue. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to