diff options
author | rama-huawei <rama.subba.reddy.s@huawei.com> | 2017-09-26 17:46:40 +0530 |
---|---|---|
committer | Rama SubbaReddy <rama.subba.reddy.s@huawei.com> | 2017-09-27 06:53:26 +0000 |
commit | 26606eb22e59fae9df5759ec5f53420a4bac8847 (patch) | |
tree | 5c14424546c28e0a1ffe82e8d2a7e703d6f69a65 | |
parent | b56d8b19013ff7cf1eb3ed858f41da7dc2c348e3 (diff) |
Repalced StringBuffer with StringBuilder
Issue-Id:SO-118
Change-Id: I7c69443dc5c17690605c4d1844823fd4307e9ccb
Signed-off-by: rama-huawei <rama.subba.reddy.s@huawei.com>
3 files changed, 13 insertions, 12 deletions
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<Map<String, String>> { ObjectMapper mapper = new ObjectMapper(); JsonNode tree = mapper.readTree(parser); - Map<String, String> map = new LinkedHashMap<String, String>(); + Map<String, String> map = new LinkedHashMap<>(); Iterator<JsonNode> iterator = tree.iterator(); while (iterator.hasNext()) { @@ -71,4 +71,4 @@ public class MapDeserializer extends JsonDeserializer<Map<String, String>> { 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<Map<String, String>> { jsonGenerator.writeStartObject(); jsonGenerator.writeArrayFieldStart("entry"); - for (String key : map.keySet()) { - String value = map.get(key); + for (Map.Entry<String,String> 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<Map<String, String>> { jsonGenerator.writeEndArray(); jsonGenerator.writeEndObject(); } -}
\ No newline at end of file +} diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java index 4675858936..309aa0641a 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java @@ -50,10 +50,10 @@ public class QueryVfModule extends CatalogQuery { "\t}"; // "\t}}"; - public QueryVfModule() { super(); vfModules = new ArrayList<VfModuleCustomization>(); } + public QueryVfModule() { super(); vfModules = new ArrayList<>(); } public QueryVfModule(List<VfModuleCustomization> vlist) { LOGGER.debug ("QueryVfModule:"); - vfModules = new ArrayList<VfModuleCustomization>(); + vfModules = new ArrayList<>(); if (vlist != null) { for (VfModuleCustomization o : vlist) { LOGGER.debug ("-- o is a vfModules ----"); @@ -69,7 +69,7 @@ public class QueryVfModule extends CatalogQuery { @Override public String toString () { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); boolean first = true; int i = 1; @@ -83,9 +83,9 @@ public class QueryVfModule extends CatalogQuery { @Override public String JSON2(boolean isArray, boolean x) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); if (isArray) buf.append("\"vfModules\": ["); - Map<String, String> valueMap = new HashMap<String, String>(); + Map<String, String> valueMap = new HashMap<>(); String sep = ""; boolean first = true; @@ -95,7 +95,7 @@ public class QueryVfModule extends CatalogQuery { boolean vfNull = o.getVfModule() == null ? true : false; boolean hasVolumeGroup = false; String envt = o.getHeatEnvironmentArtifactUuid(); - if (envt != null && !envt.equals("")) { + if (envt != null && !"".equals(envt)) { hasVolumeGroup = true; } @@ -116,4 +116,4 @@ public class QueryVfModule extends CatalogQuery { if (isArray) buf.append("]"); return buf.toString(); } -}
\ No newline at end of file +} |