Uploaded image for project: 'TomEE'
  1. TomEE
  2. TOMEE-2102

IvmContext bind/unbind creates duplicate contexts

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 7.0.4
    • None
    • None

    Description

      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

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

      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())
      

      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:

             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());
      

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

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              SvetlinZarev Svetlin Zarev
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: