AMBARI-22325. Get rid of unchecked warning in BlueprintV2Factory (adoroszlai)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0c9f28b5
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0c9f28b5
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0c9f28b5

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 0c9f28b575063908931b75ba10f5901087287ee1
Parents: 31cf0d7
Author: Attila Doroszlai <[email protected]>
Authored: Tue Nov 14 19:30:58 2017 +0100
Committer: Doroszlai, Attila <[email protected]>
Committed: Tue Dec 5 23:55:56 2017 +0100

----------------------------------------------------------------------
 .../org/apache/ambari/server/topology/BlueprintV2Factory.java   | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0c9f28b5/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
index fa12173..2c5bc8b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
@@ -20,7 +20,6 @@
 package org.apache.ambari.server.topology;
 
 import java.io.IOException;
-import java.util.HashMap;
 import java.util.Map;
 import java.util.Optional;
 import java.util.function.Function;
@@ -41,6 +40,7 @@ import org.apache.ambari.server.state.StackId;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.core.Version;
+import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.SerializationFeature;
 import com.fasterxml.jackson.databind.module.SimpleAbstractTypeResolver;
@@ -119,9 +119,8 @@ public class BlueprintV2Factory {
     return convertFromJson(blueprintEntity.getContent());
   }
 
-  @SuppressWarnings("unchecked")
   public Map<String, Object> convertToMap(BlueprintV2Entity entity) throws 
IOException {
-    return createObjectMapper().readValue(entity.getContent(), HashMap.class);
+    return createObjectMapper().readValue(entity.getContent(), new 
TypeReference<Map<String, Object>>(){});
   }
 
   private StackV2 parseStack(StackId stackId) {

Reply via email to