aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpriyanka.akhade <priyanka.akhade@huawei.com>2020-10-08 17:07:39 +0530
committerpriyanka.akhade <priyanka.akhade@huawei.com>2020-10-08 17:07:39 +0530
commitdc6d73db130483dee99640a8ee77ada4817b2023 (patch)
tree1d05f75c7125b51a0a29f3e8d93321c75daaefe2
parent8625b456b58a3328bbe5e3619e51fcfafe9ced2c (diff)
revert optimization logic in order to avoid regression in vnfsdk/validation
Signed-off-by: priyanka.akhade <priyanka.akhade@huawei.com> Issue-ID: CLI-324 Change-Id: I5822fa53df664739d02ba0babc567a7d8c093271
-rw-r--r--main/src/main/java/org/onap/cli/main/utils/OnapCliArgsParser.java19
1 files changed, 8 insertions, 11 deletions
diff --git a/main/src/main/java/org/onap/cli/main/utils/OnapCliArgsParser.java b/main/src/main/java/org/onap/cli/main/utils/OnapCliArgsParser.java
index 174dfd2a..d0885def 100644
--- a/main/src/main/java/org/onap/cli/main/utils/OnapCliArgsParser.java
+++ b/main/src/main/java/org/onap/cli/main/utils/OnapCliArgsParser.java
@@ -99,8 +99,7 @@ public class OnapCliArgsParser {
}
int positionalIdx = 0;
- int i = 0;
- while ( i < args.size()) {
+ for (int i = 0; i < args.size(); i++) {
String paramName = null;
if (shortOptionMap.containsKey(args.get(i))) {
paramName = shortOptionMap.get(args.get(i));
@@ -113,7 +112,6 @@ public class OnapCliArgsParser {
if ((i + 1) == args.size() || args.get(i + 1).startsWith("-")) {
if (paramMap.get(paramName).getParameterType().equals(OnapCommandParameterType.BOOL)) {
paramMap.get(paramName).setValue(true);
- i+=2;
continue;
}
throw new OnapCliArgumentValueMissing(args.get(i));
@@ -122,26 +120,26 @@ public class OnapCliArgsParser {
if (paramMap.get(paramName).getParameterType().equals(OnapCommandParameterType.JSON)) {
paramMap.get(paramName).setValue(readJsonStringFromUrl(args.get(i + 1),
paramMap.get(paramName).getName()));
- i+=2;
+ i++;
continue;
} else if (paramMap.get(paramName).getParameterType().equals(OnapCommandParameterType.TEXT)) {
paramMap.get(paramName).setValue(readTextStringFromUrl(args.get(i + 1),
paramMap.get(paramName).getName()));
- i+=2;
+ i++;
continue;
} else if (paramMap.get(paramName).getParameterType().equals(OnapCommandParameterType.YAML)) {
String value = readYamlStringFromUrl(args.get(i + 1),
paramMap.get(paramName).getName());
paramMap.get(paramName).setValue(value);
- i+=2;
+ i++;
continue;
} else if (paramMap.get(paramName).getParameterType().equals(OnapCommandParameterType.BYTE)) {
paramMap.get(paramName).setValue(readBytesFromUrl(args.get(i + 1),
paramMap.get(paramName).getName()));
- i+=2;
+ i++;
continue;
} else if (paramMap.get(paramName).getParameterType()
@@ -151,7 +149,7 @@ public class OnapCliArgsParser {
list.add(readTextStringFromUrl(args.get(i + 1), paramMap.get(paramName).getName()));
paramMap.get(paramName).setValue(list);
- i+=2;
+ i++;
continue;
} else if (paramMap.get(paramName).getParameterType()
@@ -173,13 +171,13 @@ public class OnapCliArgsParser {
//map.put(argArr[0], readTextStringFromUrl(argArr[1], paramMap.get(paramName).getName()));
map.put(argArr[0], argArr[1]);
paramMap.get(paramName).setValue(map);
- i+=2;
+ i++;
continue;
}
paramMap.get(paramName).setValue(args.get(i + 1));
- i+=2;
+ i++;
continue;
}
@@ -193,7 +191,6 @@ public class OnapCliArgsParser {
paramMap.get(positionArgs.get(positionalIdx)).setValue(args.get(i));
positionalIdx++;
- i+=2;
}
params.clear();