From bed34e6e8d3153d3a622d870bb7cda24215ee99c Mon Sep 17 00:00:00 2001
From: Simon Barner <barner@fortiss.org>
Date: Mon, 15 Oct 2018 15:40:26 +0200
Subject: [PATCH] Avoid infinite recursion in getParentElements()

* Walk up the model hierarchy regardless if the current element
  matches the given targetClass

Issue-Ref: 3223
Issue-Url: https://af3-developer.fortiss.org/issues/3223

Signed-off-by: Simon Barner <barner@fortiss.org>
---
 .../src/org/fortiss/tooling/kernel/utils/.ratings               | 2 +-
 .../fortiss/tooling/kernel/utils/KernelModelElementUtils.java   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/utils/.ratings b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/utils/.ratings
index e6a5f6bf9..4d05d1203 100644
--- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/utils/.ratings
+++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/utils/.ratings
@@ -7,7 +7,7 @@ ExtensionPointUtils.java 7ce63242b49eb9a7cd4eaadd223f5ebce1dfd75b GREEN
 HierarchicalNameComparator.java 6face1b673126701a0721af48ead2f9766c17d46 YELLOW
 IdentifierUtils.java fff43dc4e84cdd89c3ece4f5d9d89aec4b0749c2 GREEN
 JavaUtils.java 65cdadfb9137a240ad59992eacf53a15b7f20804 GREEN
-KernelModelElementUtils.java a7fa0e2596e06195634e3163b23fa376b2420920 GREEN
+KernelModelElementUtils.java 56c86fe9afb23053f50d7279809afd2a5bb10eba YELLOW
 LoggingUtils.java a982f7c3371e72feb8658510b5b0358876281a12 GREEN
 PrototypesUtils.java ec75bed75cfc5103f1f38e3a29df86f729428775 GREEN
 ResourceUtils.java 698c7db34acb4f1a258a1953e6afcca9823763a8 GREEN
diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/utils/KernelModelElementUtils.java b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/utils/KernelModelElementUtils.java
index a7fa0e259..56c86fe9a 100644
--- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/utils/KernelModelElementUtils.java
+++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/utils/KernelModelElementUtils.java
@@ -150,8 +150,8 @@ public final class KernelModelElementUtils {
 		while(currentElement != null && !(currentElement instanceof IProjectRootElement)) {
 			if(targetClass.isAssignableFrom(currentElement.getClass())) {
 				retList.add((T)currentElement);
-				currentElement = currentElement.eContainer();
 			}
+			currentElement = currentElement.eContainer();
 		}
 		return retList;
 	}
-- 
GitLab