Repository: brooklyn-server
Updated Branches:
  refs/heads/master f4be19000 -> 0c036913e


AbstractEntity: improve error message on previouslyOwned

Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/7d7c1a83
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/7d7c1a83
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/7d7c1a83

Branch: refs/heads/master
Commit: 7d7c1a836a5d426b47f82d64202d5859896e140b
Parents: f4be190
Author: Aled Sage <aled.s...@gmail.com>
Authored: Fri Mar 25 15:18:55 2016 +0000
Committer: Aled Sage <aled.s...@gmail.com>
Committed: Fri Mar 25 15:18:55 2016 +0000

----------------------------------------------------------------------
 .../java/org/apache/brooklyn/core/entity/AbstractEntity.java     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/7d7c1a83/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
----------------------------------------------------------------------
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 5422fb6..1406855 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
@@ -218,7 +218,7 @@ public abstract class AbstractEntity extends 
AbstractBrooklynObject implements E
     // FIXME we do not currently support changing parents, but to implement a 
cluster that can shrink we need to support at least
     // orphaning (i.e. removing ownership). This flag notes if the entity has 
previously had a parent, and if an attempt is made to
     // set a new parent an exception will be thrown.
-    boolean previouslyOwned = false;
+    private boolean previouslyOwned = false;
 
     /**
      * Whether we are still being constructed, in which case never warn in 
"assertNotYetOwned"
@@ -609,7 +609,7 @@ public abstract class AbstractEntity extends 
AbstractBrooklynObject implements E
         }
         // If we have previously had a parent and are trying to change to 
another one...
         if (previouslyOwned && entity != null)
-            throw new UnsupportedOperationException("Cannot set a parent of 
"+this+" because it has previously had a parent");
+            throw new UnsupportedOperationException("Cannot set a parent of 
"+this+" as "+entity+" because it has previously had a parent");
         // We don't have a parent, never have and are changing to having a 
parent...
 
         //make sure there is no loop

Reply via email to