aboutsummaryrefslogtreecommitdiffstats
path: root/profiles/command/src
diff options
context:
space:
mode:
Diffstat (limited to 'profiles/command/src')
-rw-r--r--profiles/command/src/main/java/org/onap/cli/fw/cmd/cmd/OpenCommandShellCmd.java20
-rw-r--r--profiles/command/src/main/java/org/onap/cli/fw/cmd/schema/OnapCommandSchemaCmdLoader.java4
2 files changed, 12 insertions, 12 deletions
diff --git a/profiles/command/src/main/java/org/onap/cli/fw/cmd/cmd/OpenCommandShellCmd.java b/profiles/command/src/main/java/org/onap/cli/fw/cmd/cmd/OpenCommandShellCmd.java
index 0ed930d1..eb7b808b 100644
--- a/profiles/command/src/main/java/org/onap/cli/fw/cmd/cmd/OpenCommandShellCmd.java
+++ b/profiles/command/src/main/java/org/onap/cli/fw/cmd/cmd/OpenCommandShellCmd.java
@@ -83,7 +83,7 @@ public class OpenCommandShellCmd extends OnapCommand {
return successStatusCodes;
}
- public void setSuccessStatusCodes(ArrayList<Integer> successStatusCodes) {
+ public void setSuccessStatusCodes(List<Integer> successStatusCodes) {
this.successStatusCodes = successStatusCodes;
}
@@ -197,7 +197,7 @@ public class OpenCommandShellCmd extends OnapCommand {
FileOutputStream stderrStream = null;
String outputValue = "";
- try {
+ try { //NOSONAR
pr.setTimeout(timeout);
if (this.getExecutionContext() != null) {
@@ -370,7 +370,7 @@ public class OpenCommandShellCmd extends OnapCommand {
// Process jsonpath macros
List<Object> values = new ArrayList<>();
- String processedPattern = "";
+ StringBuilder processedPattern = new StringBuilder();
currentIdx = 0;
int maxRows = 1; // in normal case, only one row will be there
while (currentIdx < line.length()) {
@@ -378,7 +378,7 @@ public class OpenCommandShellCmd extends OnapCommand {
if (idxS == -1) {
idxS = line.indexOf("$e{", currentIdx); //check for error stream
if (idxS == -1) {
- processedPattern += line.substring(currentIdx);
+ processedPattern.append(line.substring(currentIdx));
break;
}
}
@@ -405,23 +405,23 @@ public class OpenCommandShellCmd extends OnapCommand {
maxRows = arr.size();
}
}
- processedPattern += line.substring(currentIdx, idxS) + "%s";
+ processedPattern.append(line.substring(currentIdx, idxS) + "%s");
values.add(value);
currentIdx = idxE + 1;
}
- if (processedPattern.isEmpty()) {
+ if (processedPattern.toString().isEmpty()) {
result.add(line);
return result;
} else {
for (int i = 0; i < maxRows; i++) {
currentIdx = 0;
- String bodyProcessedLine = "";
+ StringBuilder bodyProcessedLine = new StringBuilder();
int positionalIdx = 0; // %s positional idx
while (currentIdx < processedPattern.length()) {
int idxS = processedPattern.indexOf("%s", currentIdx);
if (idxS == -1) {
- bodyProcessedLine += processedPattern.substring(currentIdx);
+ bodyProcessedLine.append(processedPattern.substring(currentIdx));
break;
}
@@ -441,7 +441,7 @@ public class OpenCommandShellCmd extends OnapCommand {
}
}
- bodyProcessedLine += processedPattern.substring(currentIdx, idxS) + valStr;
+ bodyProcessedLine.append(processedPattern.substring(currentIdx, idxS) + valStr);
currentIdx = idxEnd;
positionalIdx++;
} catch (OnapCommandResultEmpty e) {
@@ -450,7 +450,7 @@ public class OpenCommandShellCmd extends OnapCommand {
throw new OnapCommandResultMapProcessingFailed(line, e);
}
}
- result.add(bodyProcessedLine);
+ result.add(bodyProcessedLine.toString());
}
return result;
diff --git a/profiles/command/src/main/java/org/onap/cli/fw/cmd/schema/OnapCommandSchemaCmdLoader.java b/profiles/command/src/main/java/org/onap/cli/fw/cmd/schema/OnapCommandSchemaCmdLoader.java
index 965bd2b1..676aeb30 100644
--- a/profiles/command/src/main/java/org/onap/cli/fw/cmd/schema/OnapCommandSchemaCmdLoader.java
+++ b/profiles/command/src/main/java/org/onap/cli/fw/cmd/schema/OnapCommandSchemaCmdLoader.java
@@ -44,9 +44,9 @@ public class OnapCommandSchemaCmdLoader {
* @throws OnapCommandException
* on error
*/
- public static ArrayList<String> parseCmdSchema(OpenCommandShellCmd cmd,
+ public static List<String> parseCmdSchema(OpenCommandShellCmd cmd,
final Map<String, ?> values,
- boolean validate) throws OnapCommandException {
+ boolean validate) throws OnapCommandException { //NOSONAR
ArrayList<String> errorList = new ArrayList<>();
Map<String, ?> valMap = (Map<String, ?>) values.get(OnapCommandCmdConstants.CMD);