Skip to content

Commit

Permalink
[542789] Avoiding infinite loop in the case of ownership cycle.
Browse files Browse the repository at this point in the history
  • Loading branch information
khussey committed Feb 25, 2019
1 parent 7714b99 commit ffa6ae7
Showing 1 changed file with 9 additions and 3 deletions.
Expand Up @@ -9,7 +9,7 @@
* IBM - initial API and implementation
* Kenn Hussey (Embarcadero Technologies) - 199624, 184249, 204406, 208125, 204200, 213218, 213903, 220669, 208016, 226396, 271470
* Nicolas Rouquette (JPL) - 260120, 313837
* Kenn Hussey - 286329, 313601, 314971, 344907, 236184, 335125, 528925, 529564, 535301
* Kenn Hussey - 286329, 313601, 314971, 344907, 236184, 335125, 528925, 529564, 535301, 542789
* Kenn Hussey (CEA) - 327039, 358792, 364419, 366350, 307343, 382637, 273949, 389542, 389495, 316165, 392833, 399544, 322715, 163556, 212765, 397324, 204658, 408612, 411731, 269598, 422000, 416833, 424568, 427167, 418466, 419324, 429994, 433157, 439915, 446388, 454864, 458906, 461374, 463066, 468230, 481712, 491587, 495564, 512439, 512520, 514386, 514624, 517384
* Yann Tanguy (CEA) - 350402
* Christian W. Damus (CEA) - 392833, 251963, 405061, 409396, 176998, 180744, 403374, 416833, 420338, 405065, 431342
Expand Down Expand Up @@ -12550,14 +12550,20 @@ protected static Element getOwningElement(Element element, EClass eClass,
for (Element owner = element; !eClass.isInstance(owningElement)
&& owner != null;) {

owningElement = (Element) owner.eGet(
UMLPackage.Literals.ELEMENT__OWNER, resolve);
owningElement = (Element) owner
.eGet(UMLPackage.Literals.ELEMENT__OWNER, resolve);

owner = owningElement == null
? getNearestBaseElement(resolve
? owner.eContainer()
: ((InternalEObject) owner).eInternalContainer(), resolve)
: owningElement;

if (owner == element) {
throw new IllegalStateException(
"There is a cycle in the ownership hierarchy of " //$NON-NLS-1$
+ element);
}
}

return owningElement;
Expand Down

0 comments on commit ffa6ae7

Please sign in to comment.