You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2017/07/22 02:14:41 UTC
[02/10] brooklyn-server git commit: identify NPE earlier
identify NPE earlier
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/4f9564f7
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/4f9564f7
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/4f9564f7
Branch: refs/heads/master
Commit: 4f9564f7232287ea52944c98f51967678caa0abc
Parents: 1e615f5
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Wed Jul 5 14:45:24 2017 +0100
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Wed Jul 5 14:45:24 2017 +0100
----------------------------------------------------------------------
.../java/org/apache/brooklyn/core/entity/EntityDynamicType.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/4f9564f7/core/src/main/java/org/apache/brooklyn/core/entity/EntityDynamicType.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/EntityDynamicType.java b/core/src/main/java/org/apache/brooklyn/core/entity/EntityDynamicType.java
index 1709540..ecf2a17 100644
--- a/core/src/main/java/org/apache/brooklyn/core/entity/EntityDynamicType.java
+++ b/core/src/main/java/org/apache/brooklyn/core/entity/EntityDynamicType.java
@@ -47,6 +47,7 @@ import org.slf4j.LoggerFactory;
import com.google.common.annotations.Beta;
import com.google.common.base.Joiner;
+import com.google.common.base.Preconditions;
import com.google.common.base.Throwables;
import com.google.common.collect.Maps;
@@ -125,7 +126,7 @@ public class EntityDynamicType extends BrooklynDynamicType<Entity, AbstractEntit
*/
@Beta
public void addEffector(Effector<?> newEffector) {
- Effector<?> oldEffector = effectors.put(newEffector.getName(), newEffector);
+ Effector<?> oldEffector = effectors.put(Preconditions.checkNotNull(newEffector.getName(), "Missing 'name' for effector"), newEffector);
invalidateSnapshot();
if (oldEffector!=null)
instance.sensors().emit(AbstractEntity.EFFECTOR_CHANGED, newEffector.getName());