From dd37614bf83ca78ba350a063873444ca20b4fcd7 Mon Sep 17 00:00:00 2001 From: Kanagaraj Manickam k00365106 Date: Mon, 5 Feb 2018 20:34:11 +0530 Subject: Ignore those exceptions never occurs Issue-ID: CLI-50 Change-Id: If7de4980b0c7b205bd6fcbb8ead71eb017ec1a43 Signed-off-by: Kanagaraj Manickam k00365106 --- .../java/org/onap/cli/fw/http/conf/OnapCommandHttpConstants.java | 2 +- .../org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java | 2 +- .../main/java/org/onap/cli/fw/http/utils/OnapCommandHttpUtils.java | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'profiles/http') diff --git a/profiles/http/src/main/java/org/onap/cli/fw/http/conf/OnapCommandHttpConstants.java b/profiles/http/src/main/java/org/onap/cli/fw/http/conf/OnapCommandHttpConstants.java index cd10849b..b18545cb 100644 --- a/profiles/http/src/main/java/org/onap/cli/fw/http/conf/OnapCommandHttpConstants.java +++ b/profiles/http/src/main/java/org/onap/cli/fw/http/conf/OnapCommandHttpConstants.java @@ -34,7 +34,7 @@ public class OnapCommandHttpConstants { public static final String APPLICATION_JSON = "application/json"; public static final String DEFAULT_PARAMETER_HTTP_FILE_NAME = "default_input_parameters_http.yaml"; public static final String DEAFULT_PARAMETER_USERNAME = "host-username"; - public static final String DEAFULT_PARAMETER_PASSWORD = "host-password"; + public static final String DEAFULT_PARAMETER_PASSWORD = "host-password"; // NOSONAR public static final String DEAFULT_PARAMETER_HOST_URL = "host-url"; public static final String DEFAULT_PARAMETER_NO_AUTH = "no-auth"; public static final String HTTP_SCHEMA_PROFILE = "http"; diff --git a/profiles/http/src/main/java/org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java b/profiles/http/src/main/java/org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java index 6dd15884..09dac49a 100644 --- a/profiles/http/src/main/java/org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java +++ b/profiles/http/src/main/java/org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java @@ -431,7 +431,7 @@ public class OnapCommandSchemaHttpLoader { forCmd.getInfo().getService() + "-" + forCmd.getService().getAuthType() + "-" + authAction, forCmd.getInfo().getProduct()); - } catch (OnapCommandNotFound e) { + } catch (OnapCommandNotFound e) { // NOSONAR auth = OnapCommandRegistrar.getRegistrar().get( forCmd.getService().getAuthType() + "-" + authAction, forCmd.getInfo().getProduct()); diff --git a/profiles/http/src/main/java/org/onap/cli/fw/http/utils/OnapCommandHttpUtils.java b/profiles/http/src/main/java/org/onap/cli/fw/http/utils/OnapCommandHttpUtils.java index cd918783..7b10dbce 100644 --- a/profiles/http/src/main/java/org/onap/cli/fw/http/utils/OnapCommandHttpUtils.java +++ b/profiles/http/src/main/java/org/onap/cli/fw/http/utils/OnapCommandHttpUtils.java @@ -107,8 +107,8 @@ public class OnapCommandHttpUtils { String key = entry.getKey(); try { resultsProcessed.put(key, OnapCommandHttpUtils.replaceLineFromOutputResults(resultMap.get(key), resultHttp)); - } catch(OnapCommandResultEmpty e) { - // pass // NOSONAR + } catch(OnapCommandResultEmpty e) { // NOSONAR + // pass } } @@ -174,7 +174,7 @@ public class OnapCommandHttpUtils { try { // JSONArray or String value = JsonPath.read(resultHttp.getBody(), jsonPath); - } catch (PathNotFoundException e1) { + } catch (PathNotFoundException e1) { // NOSONAR //set to blank for those entries which are missing from the output json value = ""; } catch (Exception e) { -- cgit 1.2.3-korg From b6831eb583cd12b776900c06a32bed4835d109e3 Mon Sep 17 00:00:00 2001 From: Kanagaraj Manickam k00365106 Date: Mon, 5 Feb 2018 20:40:34 +0530 Subject: Make Closable objects are used latter Issue-ID: CLI-50 Change-Id: I5e54f97ca359ee008a1ef82804b47a4e42231cc3 Signed-off-by: Kanagaraj Manickam k00365106 --- .../main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java | 5 ++--- .../main/java/org/onap/cli/fw/http/connect/OnapHttpConnection.java | 2 +- .../org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) (limited to 'profiles/http') diff --git a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java index bcf93269..b47000a1 100644 --- a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java +++ b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java @@ -145,8 +145,7 @@ public class OnapCommandSchemaLoader { try { List errors = new ArrayList<>(); if (includeDefault) { - Map defaultParameterMap = includeDefault ? - validateSchemaVersion(DEFAULT_PARAMETER_FILE_NAME, cmd.getSchemaVersion()) : new HashMap<>(); + Map defaultParameterMap = validateSchemaVersion(DEFAULT_PARAMETER_FILE_NAME, cmd.getSchemaVersion()); //mrkanag default_parameter is supported only for parameters. if (defaultParameterMap.containsKey(INFO)) { defaultParameterMap.remove(OnapCommandConstants.INFO); @@ -508,7 +507,7 @@ public class OnapCommandSchemaLoader { public static InputStream loadSchemaFromFile(String schemaLocation) throws OnapCommandInvalidSchema { File schemaFile = new File(schemaLocation); try { - FileInputStream inputFileStream = new FileInputStream(schemaFile); + FileInputStream inputFileStream = new FileInputStream(schemaFile); // NOSONAR if (!schemaFile.isFile()) { throw new OnapCommandInvalidSchema(schemaFile.getName(), SCHEMA_FILE_NOT_EXIST); } diff --git a/profiles/http/src/main/java/org/onap/cli/fw/http/connect/OnapHttpConnection.java b/profiles/http/src/main/java/org/onap/cli/fw/http/connect/OnapHttpConnection.java index 5b6df29d..3e03efa7 100644 --- a/profiles/http/src/main/java/org/onap/cli/fw/http/connect/OnapHttpConnection.java +++ b/profiles/http/src/main/java/org/onap/cli/fw/http/connect/OnapHttpConnection.java @@ -129,7 +129,7 @@ public class OnapHttpConnection { this.httpClient = HttpClients.custom().setConnectionManager(connManager) .setRedirectStrategy(new LaxRedirectStrategy()).build(); } else { - this.httpClient = HttpClients.createDefault(); + this.httpClient = HttpClients.createDefault(); // NOSONAR } } catch (Exception e) { throw new OnapCommandHttpFailure(e); diff --git a/profiles/http/src/main/java/org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java b/profiles/http/src/main/java/org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java index 09dac49a..4af591ae 100644 --- a/profiles/http/src/main/java/org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java +++ b/profiles/http/src/main/java/org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java @@ -52,8 +52,7 @@ public class OnapCommandSchemaHttpLoader { try { List errors = new ArrayList<>(); if (includeDefault) { - Map defaultParameterMap = includeDefault ? - OnapCommandSchemaLoader.validateSchemaVersion(OnapCommandHttpConstants.DEFAULT_PARAMETER_HTTP_FILE_NAME, cmd.getSchemaVersion()) : new HashMap<>(); + Map defaultParameterMap = OnapCommandSchemaLoader.validateSchemaVersion(OnapCommandHttpConstants.DEFAULT_PARAMETER_HTTP_FILE_NAME, cmd.getSchemaVersion()); //mrkanag default_parameter is supported only for parameters. if (defaultParameterMap.containsKey(OnapCommandConstants.INFO)) { -- cgit 1.2.3-korg