brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjcorb...@apache.org
Subject [2/8] brooklyn-server git commit: getEffectorByName returns absent rather than throwing NPE when arg null.
Date Tue, 18 Oct 2016 12:43:28 GMT
getEffectorByName returns absent rather than throwing NPE when arg null.


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

Branch: refs/heads/master
Commit: 8bbf68a07f86b06900fcd84cf9b6f71669f97bc5
Parents: fea8a6e
Author: Sam Corbett <sam.corbett@cloudsoftcorp.com>
Authored: Thu Oct 13 11:24:15 2016 +0100
Committer: Sam Corbett <sam.corbett@cloudsoftcorp.com>
Committed: Thu Oct 13 11:24:15 2016 +0100

----------------------------------------------------------------------
 .../apache/brooklyn/core/entity/EntityTypeSnapshot.java   | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/8bbf68a0/core/src/main/java/org/apache/brooklyn/core/entity/EntityTypeSnapshot.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/EntityTypeSnapshot.java b/core/src/main/java/org/apache/brooklyn/core/entity/EntityTypeSnapshot.java
index ef5c710..50e99f7 100644
--- a/core/src/main/java/org/apache/brooklyn/core/entity/EntityTypeSnapshot.java
+++ b/core/src/main/java/org/apache/brooklyn/core/entity/EntityTypeSnapshot.java
@@ -64,11 +64,13 @@ public class EntityTypeSnapshot extends BrooklynTypeSnapshot implements
EntityTy
 
     @Override
     public Maybe<Effector<?>> getEffectorByName(String name) {
-        for (Effector<?> contender : effectors) {
-            if (name.equals(contender.getName()))
-                return Maybe.<Effector<?>>of(contender);
+        if (name != null) {
+            for (Effector<?> contender : effectors) {
+                if (name.equals(contender.getName()))
+                    return Maybe.<Effector<?>>of(contender);
+            }
         }
-        return Maybe.<Effector<?>>absent("No effector matching '"+name+"'");
       
+        return Maybe.<Effector<?>>absent("No effector matching '" + name + "'");
     }
     
     @Override


Mime
View raw message