diff options
Diffstat (limited to 'profiles/command')
-rw-r--r-- | profiles/command/pom.xml | 2 | ||||
-rw-r--r-- | profiles/command/src/main/java/org/onap/cli/fw/cmd/cmd/OpenCommandShellCmd.java | 24 |
2 files changed, 15 insertions, 11 deletions
diff --git a/profiles/command/pom.xml b/profiles/command/pom.xml index 673cd985..b40cf3e1 100644 --- a/profiles/command/pom.xml +++ b/profiles/command/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.cli</groupId> <artifactId>cli-profiles</artifactId> - <version>2.0.5</version> + <version>2.0.6</version> </parent> <artifactId>cli-profiles-command</artifactId> 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 69987d9b..8e94db85 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 @@ -138,7 +138,7 @@ public class OpenCommandShellCmd extends OnapCommand { cwd); try { pr.run(); - } catch (InterruptedException | IOException e) { + } catch (Exception e) { throw new OnapCommandExecutionFailed(this.getName(), e); } @@ -251,21 +251,25 @@ public class OpenCommandShellCmd extends OnapCommand { bodyProcessedLine += processedPattern.substring(currentIdx); break; } - int idxE = idxS + 2; // %s + + int idxEnd = idxS + 2; // %s + try { - Object value = values.get(positionalIdx); - String valueS = String.valueOf(value); - if (value instanceof JSONArray) { - JSONArray arr = (JSONArray) value; - if (!arr.isEmpty()) { - valueS = arr.get(i).toString(); + Object val = values.get(positionalIdx); + String valStr = String.valueOf(val); + + if (val instanceof JSONArray) { + JSONArray aJson = (JSONArray) val; + + if (!aJson.isEmpty()) { + valStr = aJson.get(i).toString(); } else { throw new OnapCommandResultEmpty(); } } - bodyProcessedLine += processedPattern.substring(currentIdx, idxS) + valueS; - currentIdx = idxE; + bodyProcessedLine += processedPattern.substring(currentIdx, idxS) + valStr; + currentIdx = idxEnd; positionalIdx++; } catch (OnapCommandResultEmpty e) { throw e; |