brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject brooklyn-server git commit: Rest API location transformers use mutable map
Date Wed, 06 Apr 2016 17:29:20 GMT
Repository: brooklyn-server
Updated Branches:
  refs/heads/0.9.0 b174eb0e7 -> 718aea7d2


Rest API location transformers use mutable map

LocationConfig contains null values which Guava's ImmutableMap rejects
with a NullPointerException


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

Branch: refs/heads/0.9.0
Commit: 718aea7d27ce21835860d2de6a31d0e9474bee85
Parents: b174eb0
Author: Sam Corbett <sam.corbett@cloudsoftcorp.com>
Authored: Tue Apr 5 12:25:46 2016 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Wed Apr 6 18:29:01 2016 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/brooklyn/rest/domain/LocationSpec.java | 5 +++--
 .../org/apache/brooklyn/rest/transform/LocationTransformer.java | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/718aea7d/rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/LocationSpec.java
----------------------------------------------------------------------
diff --git a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/LocationSpec.java
b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/LocationSpec.java
index 4738381..70980bc 100644
--- a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/LocationSpec.java
+++ b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/LocationSpec.java
@@ -25,9 +25,10 @@ import java.util.Objects;
 
 import javax.annotation.Nullable;
 
+import org.apache.brooklyn.util.collections.MutableMap;
+
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.google.common.collect.ImmutableMap;
 
 // FIXME change name, due to confusion with LocationSpec <- no need, as we can kill the
class instead soon!
 /** @deprecated since 0.7.0 location spec objects will not be used from the client, instead
pass yaml location spec strings */
@@ -53,7 +54,7 @@ public class LocationSpec implements HasName, HasConfig, Serializable {
             @JsonProperty("config") @Nullable Map<String, ?> config) {
         this.name = name;
         this.spec = spec;
-        this.config = (config == null) ? Collections.<String, String> emptyMap() :
ImmutableMap.copyOf(config);
+        this.config = (config == null) ? Collections.<String, String> emptyMap() :
MutableMap.copyOf(config);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/718aea7d/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/transform/LocationTransformer.java
----------------------------------------------------------------------
diff --git a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/transform/LocationTransformer.java
b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/transform/LocationTransformer.java
index b80ee60..3777901 100644
--- a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/transform/LocationTransformer.java
+++ b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/transform/LocationTransformer.java
@@ -121,7 +121,7 @@ public class LocationTransformer {
     }
 
     private static Map<String, ?> copyConfig(Map<String,?> entries, LocationDetailLevel
level) {
-        ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();
+        MutableMap.Builder<String, Object> builder = MutableMap.builder();
         if (level!=LocationDetailLevel.NONE) {
             for (Map.Entry<String,?> entry : entries.entrySet()) {
                 if (level==LocationDetailLevel.FULL_INCLUDING_SECRET || !Sanitizer.IS_SECRET_PREDICATE.apply(entry.getKey()))
{


Mime
View raw message