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/fd61401c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/fd61401c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/fd61401c

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: fd61401c0a998ed614c6bfe5ba2cad3a77e2ec5c
Parents: a217357
Author: Attila Doroszlai <adorosz...@hortonworks.com>
Authored: Tue Nov 14 19:30:58 2017 +0100
Committer: Doroszlai, Attila <adorosz...@hortonworks.com>
Committed: Fri Dec 8 20:24:24 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/fd61401c/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