diff options
author | jitendra007 <jitendra.sharma1@huawei.com> | 2020-07-21 14:35:31 +0530 |
---|---|---|
committer | priyanka.akhade <priyanka.akhade@huawei.com> | 2020-08-04 09:44:38 +0530 |
commit | 9921b1751cde31721958d004935f2b7fc5e95513 (patch) | |
tree | e41a158075ba6f95af21fc9ef25425e0dca51851 /framework/src/main/java/org/onap | |
parent | fc9af3118881c83a0928e9a21135641808288f84 (diff) |
Code improvement for pending sonar issues
Issue-ID: CLI-270
Signed-off-by: jitendra007 <jitendra.sharma1@huawei.com>
Change-Id: Ie27d3ff077fa1ef4d13788849aa82d695f183eeb
Diffstat (limited to 'framework/src/main/java/org/onap')
5 files changed, 23 insertions, 23 deletions
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<String>()); + 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<String>())) { + 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<String, ?> mergeSchemas(OnapCommand cmd) throws OnapCommandException { - Map<String, Object> mergedResult = new LinkedHashMap<String, Object>(); + public static Map<String, Object> mergeSchemas(OnapCommand cmd) throws OnapCommandException { + Map<String, Object> mergedResult = new LinkedHashMap<>(); for (String schema: cmd.getSchemas()) { - Map<String , Object> schemaMap = (Map<String, Object>) OnapCommandSchemaLoader.validateSchemaVersion(schema, cmd.getSchemaVersion()); + Map<String , Object> 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<String, String>()); + 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<String, String>()); + 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<String, String>()); + copyParamsFrom(from, to, new HashMap<>()); } /** |