From 9921b1751cde31721958d004935f2b7fc5e95513 Mon Sep 17 00:00:00 2001 From: jitendra007 Date: Tue, 21 Jul 2020 14:35:31 +0530 Subject: Code improvement for pending sonar issues Issue-ID: CLI-270 Signed-off-by: jitendra007 Change-Id: Ie27d3ff077fa1ef4d13788849aa82d695f183eeb --- .../cli/fw/cmd/product/OnapServiceListCommand.java | 4 ++-- .../cli/fw/schema/OnapCommandSchemaMerger.java | 8 +++---- .../cli/fw/store/OnapCommandExecutionStore.java | 28 +++++++++++----------- .../onap/cli/fw/store/OnapCommandProfileStore.java | 2 +- .../org/onap/cli/fw/utils/OnapCommandUtils.java | 4 ++-- 5 files changed, 23 insertions(+), 23 deletions(-) (limited to 'framework') diff --git a/framework/src/main/java/org/onap/cli/fw/cmd/product/OnapServiceListCommand.java b/framework/src/main/java/org/onap/cli/fw/cmd/product/OnapServiceListCommand.java index 880f83ea..36c701ce 100644 --- a/framework/src/main/java/org/onap/cli/fw/cmd/product/OnapServiceListCommand.java +++ b/framework/src/main/java/org/onap/cli/fw/cmd/product/OnapServiceListCommand.java @@ -51,7 +51,7 @@ public class OnapServiceListCommand extends OnapCommand { } if (!rslt.containsKey(schema.getProduct())) { - rslt.put(schema.getProduct(), new HashSet()); + rslt.put(schema.getProduct(), new HashSet<>()); } rslt.get(schema.getProduct()).add(schema.getService()); } @@ -71,7 +71,7 @@ public class OnapServiceListCommand extends OnapCommand { } } - for (String service : rslt.getOrDefault(product, new HashSet())) { + for (String service : rslt.getOrDefault(product, new HashSet<>())) { this.getResult().getRecordsMap().get("product").getValues().add(product); this.getResult().getRecordsMap().get("service").getValues().add(service); this.getResult().getRecordsMap().get("description").getValues().add( diff --git a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java index c2ae189b..9a6a4e78 100644 --- a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java +++ b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java @@ -33,13 +33,13 @@ import org.slf4j.LoggerFactory; */ public class OnapCommandSchemaMerger { - static Logger LOG = LoggerFactory.getLogger(OnapCommandSchemaMerger.class); + static Logger logger = LoggerFactory.getLogger(OnapCommandSchemaMerger.class); - public static Map mergeSchemas(OnapCommand cmd) throws OnapCommandException { - Map mergedResult = new LinkedHashMap(); + public static Map mergeSchemas(OnapCommand cmd) throws OnapCommandException { + Map mergedResult = new LinkedHashMap<>(); for (String schema: cmd.getSchemas()) { - Map schemaMap = (Map) OnapCommandSchemaLoader.validateSchemaVersion(schema, cmd.getSchemaVersion()); + Map schemaMap = OnapCommandSchemaLoader.validateSchemaVersion(schema, cmd.getSchemaVersion()); mergeYamlMap(mergedResult, schemaMap); } diff --git a/framework/src/main/java/org/onap/cli/fw/store/OnapCommandExecutionStore.java b/framework/src/main/java/org/onap/cli/fw/store/OnapCommandExecutionStore.java index 7352eced..839d1427 100644 --- a/framework/src/main/java/org/onap/cli/fw/store/OnapCommandExecutionStore.java +++ b/framework/src/main/java/org/onap/cli/fw/store/OnapCommandExecutionStore.java @@ -41,20 +41,20 @@ import org.slf4j.LoggerFactory; public class OnapCommandExecutionStore { private static Logger log = LoggerFactory.getLogger(OnapCommandExecutionStore.class); - private static boolean storeReady = false; - private static String REQUEST_ID = "requestId"; - private static String EXECUTION_ID = "executionId"; - private static String INPUT = "input"; - private static String STDOUT = "stdout"; - private static String STDERR = "stderr"; - private static String DEBUG = "debug"; - private static String IN_PROGRESS = "in-progress"; - private static String OUTPUT = "output"; - private static String ERROR = "error"; - private static String COMPLETED = "completed"; - private static String FAILED = "failed"; - private static String EXECUTIONID = "execution-id"; - private static String REQUESTID = "request-id"; + private static boolean storeReady = false; // NOSONAR + private static final String REQUEST_ID = "requestId"; + private static final String EXECUTION_ID = "executionId"; + private static final String INPUT = "input"; + private static final String STDOUT = "stdout"; + private static final String STDERR = "stderr"; + private static final String DEBUG = "debug"; + private static final String IN_PROGRESS = "in-progress"; + private static final String OUTPUT = "output"; + private static final String ERROR = "error"; + private static final String COMPLETED = "completed"; + private static final String FAILED = "failed"; + private static final String EXECUTIONID = "execution-id"; + private static final String REQUESTID = "request-id"; private SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US); diff --git a/framework/src/main/java/org/onap/cli/fw/store/OnapCommandProfileStore.java b/framework/src/main/java/org/onap/cli/fw/store/OnapCommandProfileStore.java index 39645120..732ad002 100644 --- a/framework/src/main/java/org/onap/cli/fw/store/OnapCommandProfileStore.java +++ b/framework/src/main/java/org/onap/cli/fw/store/OnapCommandProfileStore.java @@ -88,7 +88,7 @@ public class OnapCommandProfileStore { public void add(String productVersion, String paramName, String paramValue) { if (!paramCache.containsKey(productVersion)) { - paramCache.put(productVersion, new HashMap()); + paramCache.put(productVersion, new HashMap<>()); } paramCache.get(productVersion).put(paramName, paramValue); diff --git a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java index 58fe7df6..dab6669c 100644 --- a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java +++ b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java @@ -190,7 +190,7 @@ public class OnapCommandUtils { * @return */ public static String replaceLineForSpecialValues(String lineSpl) { - return replaceLineForSpecialValues(lineSpl, new HashMap()); + return replaceLineForSpecialValues(lineSpl, new HashMap<>()); } /** @@ -410,7 +410,7 @@ public class OnapCommandUtils { } public static void copyParamsFrom(OnapCommand from, OnapCommand to) throws OnapCommandInvalidParameterValue { - copyParamsFrom(from, to, new HashMap()); + copyParamsFrom(from, to, new HashMap<>()); } /** -- cgit 1.2.3-korg