brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grk...@apache.org
Subject incubator-brooklyn git commit: Check for null when looking up persisted ConfigKey
Date Fri, 14 Nov 2014 00:28:38 GMT
Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master 8e0e1b4aa -> c77f9ff4b


Check for null when looking up persisted ConfigKey


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

Branch: refs/heads/master
Commit: c77f9ff4b658732291e8f176f54851b0b9f58e88
Parents: 8e0e1b4
Author: Andrew Kennedy <grkvlt@apache.org>
Authored: Fri Nov 14 00:28:12 2014 +0000
Committer: Andrew Kennedy <grkvlt@apache.org>
Committed: Fri Nov 14 00:28:25 2014 +0000

----------------------------------------------------------------------
 core/src/main/java/brooklyn/basic/BrooklynDynamicType.java | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c77f9ff4/core/src/main/java/brooklyn/basic/BrooklynDynamicType.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/basic/BrooklynDynamicType.java b/core/src/main/java/brooklyn/basic/BrooklynDynamicType.java
index 011c499..a7ce807 100644
--- a/core/src/main/java/brooklyn/basic/BrooklynDynamicType.java
+++ b/core/src/main/java/brooklyn/basic/BrooklynDynamicType.java
@@ -162,15 +162,14 @@ public abstract class BrooklynDynamicType<T extends BrooklynObject,
AbstractT ex
                 if (optionalInstance==null) continue;
             }
             try {
-                ConfigKey<?> k = isConfigKey ? (ConfigKey<?>) f.get(optionalInstance)
: 
-                    ((HasConfigKey<?>)f.get(optionalInstance)).getConfigKey();
-                
-                if (k==null) {
+                Object v = f.get(optionalInstance);
+
+                if (v == null) {
                     LOG.warn("no value defined for config key field (skipping): "+f);
                 } else {
+                    ConfigKey<?> k = isConfigKey ? (ConfigKey<?>) v : ((HasConfigKey<?>)
v).getConfigKey();
                     configKeysAll.put(k.getName(), new FieldAndValue<ConfigKey<?>>(f,
k));
                 }
-                
             } catch (IllegalAccessException e) {
                 LOG.warn("cannot access config key (skipping): "+f);
             }


Mime
View raw message