diff options
author | Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com> | 2018-02-05 20:27:32 +0530 |
---|---|---|
committer | Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com> | 2018-02-05 20:27:32 +0530 |
commit | 8bf3e7795bcc1c068b800bf3a974312a47e883a2 (patch) | |
tree | ca0c8f9c262b0577dec1040dad865fa6467496bc /framework/src/main | |
parent | d701b812258d0e84a5d5cce0296b004e364a1a3b (diff) |
Improve spl macro handling
Issue-ID: CLI-50
Change-Id: Ia25e6b66ee1ad8c2eee80c8759c62e0a8bd698c1
Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'framework/src/main')
-rw-r--r-- | framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java | 24 |
1 files changed, 12 insertions, 12 deletions
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) |