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 2014/11/15 02:03:41 UTC

[2/3] incubator-brooklyn git commit: Fix NPE on creating entities with no explicit location

Fix NPE on creating entities with no explicit location


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/5868b7d6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/5868b7d6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/5868b7d6

Branch: refs/heads/master
Commit: 5868b7d65a247512cb14d78f0406ca7de52eb508
Parents: 253583e
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Authored: Sat Nov 15 00:14:28 2014 +0200
Committer: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Committed: Sat Nov 15 00:28:10 2014 +0200

----------------------------------------------------------------------
 .../entity/software/MachineLifecycleEffectorTasks.java       | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5868b7d6/software/base/src/main/java/brooklyn/entity/software/MachineLifecycleEffectorTasks.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/brooklyn/entity/software/MachineLifecycleEffectorTasks.java b/software/base/src/main/java/brooklyn/entity/software/MachineLifecycleEffectorTasks.java
index 65b0428..8381e99 100644
--- a/software/base/src/main/java/brooklyn/entity/software/MachineLifecycleEffectorTasks.java
+++ b/software/base/src/main/java/brooklyn/entity/software/MachineLifecycleEffectorTasks.java
@@ -152,12 +152,18 @@ public abstract class MachineLifecycleEffectorTasks {
         return new EffectorBody<Void>() {
             @Override
             public Void call(ConfigBag parameters) {
+                Collection<? extends Location> locations  = null;
+
                 Object locationsRaw = parameters.getStringKey(LOCATIONS.getName());
-                Collection<? extends Location> locations = Locations.coerceToCollection(entity().getManagementContext(), locationsRaw);
+                if (locationsRaw != null) {
+                    locations = Locations.coerceToCollection(entity().getManagementContext(), locationsRaw);
+                }
+
                 if (locations==null) {
                     // null/empty will mean to inherit from parent
                     locations = Collections.emptyList();
                 }
+
                 start(locations);
                 return null;
             }