[
https://issues.apache.org/jira/browse/TOMEE-2102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16094340#comment-16094340
]
ASF GitHub Bot commented on TOMEE-2102:
---------------------------------------
GitHub user SvetlinZarev opened a pull request:
https://github.com/apache/tomee/pull/94
TOMEE-2102: IvmContext bind/unbind creates duplicate contexts
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/SvetlinZarev/tomee fixBindUndbind
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/tomee/pull/94.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #94
----
commit 12bf481e9bdbaec232c655abb63e1fd496d98fdd
Author: Svetlin Zarev <[email protected]>
Date: 2017-07-20T06:44:11Z
Add tests that verify the behaviour of IvmContext bind/unbind
----
> 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:
> {code}
> 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)