Repository: tomee Updated Branches: refs/heads/master 8ed192c8e -> bfaefb36e
Fix TOMEE-2087 - Correctly list the IvmContext content Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/f575f1c4 Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/f575f1c4 Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/f575f1c4 Branch: refs/heads/master Commit: f575f1c4bd227cc2d3f54fe4d779319fb1bc40b8 Parents: 04ab19b Author: Svetlin Zarev <svetlin.za...@abv.bg> Authored: Sun Jul 9 17:23:51 2017 +0300 Committer: Svetlin Zarev <svetlin.za...@abv.bg> Committed: Sun Jul 9 20:47:05 2017 +0300 ---------------------------------------------------------------------- .../openejb/core/ivm/naming/IvmContext.java | 22 +++++++++----------- 1 file changed, 10 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/f575f1c4/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java b/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java index e172743..4396df5 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java @@ -571,7 +571,7 @@ public class IvmContext implements Context, Serializable { vect.addElement(node); } - gatherNodes(mynode, node, vect); + gatherNodes(parentNode, node, vect); buildEnumeration(vect); } @@ -582,8 +582,9 @@ public class IvmContext implements Context, Serializable { addInListIfNeeded(initiallyRequestedNode, node.getLessTree(), vect); addInListIfNeeded(initiallyRequestedNode, node.getGrtrTree(), vect); addInListIfNeeded(initiallyRequestedNode, node.getSubTree(), vect); - if (NameNode.Federation.class.isInstance(node.getObject())) { // tomcat mainly - for (final Context c : NameNode.Federation.class.cast(node.getObject())) { + + if (NameNode.Federation.class.isInstance(initiallyRequestedNode.getObject())) { // tomcat mainly + for (final Context c : NameNode.Federation.class.cast(initiallyRequestedNode.getObject())) { if (c == IvmContext.this || !IvmContext.class.isInstance(c)) { continue; } @@ -612,17 +613,14 @@ public class IvmContext implements Context, Serializable { if (node.getParent() == parent) { return true; } - if (node.getParentTree() == node.getParent()) { // no need to browse the tree - return false; - } - NameNode current = node.getParentTree(); - while (current != null) { - if (current == parent) { - return true; - } - current = current.getParentTree(); + /* + * Handle the special case of the top-level contexts like global, module, app, etc + */ + if (null == node.getParent() && null == parent.getParentTree()) { + return true; } + return false; }