From 26606eb22e59fae9df5759ec5f53420a4bac8847 Mon Sep 17 00:00:00 2001 From: rama-huawei Date: Tue, 26 Sep 2017 17:46:40 +0530 Subject: Repalced StringBuffer with StringBuilder Issue-Id:SO-118 Change-Id: I7c69443dc5c17690605c4d1844823fd4307e9ccb Signed-off-by: rama-huawei --- .../main/java/org/openecomp/mso/adapters/json/MapDeserializer.java | 4 ++-- .../main/java/org/openecomp/mso/adapters/json/MapSerializer.java | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'adapters/mso-adapters-rest-interface/src') diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java index 6d3f8f7b1c..f51cb0dd64 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java @@ -55,7 +55,7 @@ public class MapDeserializer extends JsonDeserializer> { ObjectMapper mapper = new ObjectMapper(); JsonNode tree = mapper.readTree(parser); - Map map = new LinkedHashMap(); + Map map = new LinkedHashMap<>(); Iterator iterator = tree.iterator(); while (iterator.hasNext()) { @@ -71,4 +71,4 @@ public class MapDeserializer extends JsonDeserializer> { return map; } -} \ No newline at end of file +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java index 1db69f41ab..c2ea8242c3 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java @@ -53,8 +53,9 @@ public class MapSerializer extends JsonSerializer> { jsonGenerator.writeStartObject(); jsonGenerator.writeArrayFieldStart("entry"); - for (String key : map.keySet()) { - String value = map.get(key); + for (Map.Entry entry : map.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); jsonGenerator.writeStartObject(); jsonGenerator.writeStringField("key", key); jsonGenerator.writeStringField("value", value); @@ -64,4 +65,4 @@ public class MapSerializer extends JsonSerializer> { jsonGenerator.writeEndArray(); jsonGenerator.writeEndObject(); } -} \ No newline at end of file +} -- cgit 1.2.3-korg