This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git
commit eb260ac65dc2827261f9b8410d118d966d711871 Author: Alex Heneveld <[email protected]> AuthorDate: Thu Feb 2 10:10:41 2023 +0000 improve what happens when we reparent an entity --- core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java b/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java index 277ea446fb..2f378db6be 100644 --- a/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java +++ b/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java @@ -589,6 +589,9 @@ public abstract class AbstractEntity extends AbstractBrooklynObject implements E if (Entities.isDescendant(this, entity)) throw new IllegalStateException("loop detected trying to set parent of "+this+" as "+entity+", which is already a descendent"); + // 2023-01 - previously we didn't clear the parent, but it ends up as child of two things if we don't so do + clearParent(); + parent.set(entity); entity.addChild(getProxyIfAvailable()); config().refreshInheritedConfig();
