diff options
author | Kanagaraj Manickam <kanagaraj.manickam@huawei.com> | 2018-02-06 06:25:22 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-02-06 06:25:22 +0000 |
commit | 55386d02df6cda4581a4207233e0f72353f9fbb7 (patch) | |
tree | 07283ed931ebf2c2afd93f84832457b5870b87f9 /framework | |
parent | 3e8603790c2cf85f140f531cbbd0698547ba2ebc (diff) | |
parent | b6831eb583cd12b776900c06a32bed4835d109e3 (diff) |
Merge changes I5e54f97c,If7de4980,Ia25e6b66
* changes:
Make Closable objects are used latter
Ignore those exceptions never occurs
Improve spl macro handling
Diffstat (limited to 'framework')
4 files changed, 17 insertions, 18 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/registrar/OnapCommandRegistrar.java b/framework/src/main/java/org/onap/cli/fw/registrar/OnapCommandRegistrar.java index 19dc3f56..854b55be 100644 --- a/framework/src/main/java/org/onap/cli/fw/registrar/OnapCommandRegistrar.java +++ b/framework/src/main/java/org/onap/cli/fw/registrar/OnapCommandRegistrar.java @@ -314,8 +314,8 @@ public class OnapCommandRegistrar { String versionInfo = ""; try { versionInfo = IOUtils.toString(this.getClass().getClassLoader().getResourceAsStream(OnapCommandConstants.VERSION_INFO)); - } catch (IOException e) { - //Never occurs // NOSONAR + } catch (IOException e) { // NOSONAR + //Never occurs } versionInfo = versionInfo.replaceAll(OnapCommandConstants.VERSION_INFO_PLACE_HOLDER_ENB_PRD_VER, configuredProductVersion); 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<String> errors = new ArrayList<>(); if (includeDefault) { - Map<String, ?> defaultParameterMap = includeDefault ? - validateSchemaVersion(DEFAULT_PARAMETER_FILE_NAME, cmd.getSchemaVersion()) : new HashMap<>(); + Map<String, ?> 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/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandHelperUtils.java b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandHelperUtils.java index 5e8c3f52..81589b09 100644 --- a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandHelperUtils.java +++ b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandHelperUtils.java @@ -53,7 +53,7 @@ public class OnapCommandHelperUtils { impBuildDate = attributes.getValue("Build-Time"); } - catch (IOException e) + catch (IOException e) // NOSONAR { //Ignore it as it will never occur } 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 93a34577..bd910748 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 @@ -173,25 +173,25 @@ public class OnapCommandUtils { * There are unique values like uuid is supported, so when input, output (default) values has * these special entries, then it will get replaced with it's value * - * @param line + * @param lineSpl * @return */ - public static String replaceLineForSpecialValues(String line) { - String result = ""; + public static String replaceLineForSpecialValues(String lineSpl) { + String resultSpl = ""; - if (!line.contains("$s{")) { - return line; + if (!lineSpl.contains("$s{")) { + return lineSpl; } int currentIdx = 0; - while (currentIdx < line.length()) { - int idxS = line.indexOf("$s{", currentIdx); + while (currentIdx < lineSpl.length()) { + int idxS = lineSpl.indexOf("$s{", currentIdx); if (idxS == -1) { - result += line.substring(currentIdx); + resultSpl += lineSpl.substring(currentIdx); break; } - int idxE = line.indexOf("}", idxS); - String splEntry = line.substring(idxS + 3, idxE); + int idxE = lineSpl.indexOf("}", idxS); + String splEntry = lineSpl.substring(idxS + 3, idxE); splEntry = splEntry.trim(); String value = ""; @@ -218,11 +218,11 @@ public class OnapCommandUtils { } } - result += line.substring(currentIdx, idxS) + value; + resultSpl += lineSpl.substring(currentIdx, idxS) + value; currentIdx = idxE + 1; } - return result; + return resultSpl; } public static String replaceLineFromInputParameters(String line, Map<String, OnapCommandParameter> params) |