diff options
author | Jorge Hernandez <jh1730@att.com> | 2018-09-14 13:19:52 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-09-14 13:19:52 +0000 |
commit | ec351d2ee36a37af78476feaff401fac47afe524 (patch) | |
tree | ba9de9c01422f471c18120e5e5be618597f3d706 /auth | |
parent | 330836ad1aa9c88dd3c308fcd750ccd1aaf3e4b9 (diff) | |
parent | cd68fc9bae7d6258f77ff59c1431e4f925f61a4c (diff) |
Merge "Address sonar/Checkstyle Issues"
Diffstat (limited to 'auth')
-rw-r--r-- | auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorLoop.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorLoop.java b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorLoop.java index 7a34ce7c1..513f31e67 100644 --- a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorLoop.java +++ b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorLoop.java @@ -51,6 +51,9 @@ import org.onap.policy.apex.model.utilities.TreeMapUtils; * @author Liam Fallon (liam.fallon@ericsson.com) */ public class CommandLineEditorLoop { + // Recurring string constants + private static final String COMMAND = "command "; + // The model handler that is handling the API towards the Apex model being editied private final ApexModelHandler modelHandler; @@ -325,11 +328,11 @@ public class CommandLineEditorLoop { for (final Entry<String, String> argument : getCommandArguments(commandWords)) { final List<Entry<String, CommandLineArgumentValue>> foundArguments = TreeMapUtils .findMatchingEntries(argumentValues, argument.getKey()); - if (foundArguments.size() == 0) { - throw new CommandLineException("command " + stringAL2String(commandWords) + ": " + " argument \"" + if (foundArguments.isEmpty()) { + throw new CommandLineException(COMMAND + stringAL2String(commandWords) + ": " + " argument \"" + argument.getKey() + "\" not allowed on command"); } else if (foundArguments.size() > 1) { - throw new CommandLineException("command " + stringAL2String(commandWords) + ": " + " argument " + throw new CommandLineException(COMMAND + stringAL2String(commandWords) + ": " + " argument " + argument + " matches multiple arguments [" + argumentAL2String(foundArguments) + ']'); } @@ -343,7 +346,7 @@ public class CommandLineEditorLoop { // Argument values are null by default so if this argument is not nullable it is // mandatory if (!argumentValue.isSpecified() && !argumentValue.getCliArgument().isNullable()) { - throw new CommandLineException("command " + stringAL2String(commandWords) + ": " + throw new CommandLineException(COMMAND + stringAL2String(commandWords) + ": " + " mandatory argument \"" + argumentValue.getCliArgument().getArgumentName() + "\" not specified"); } |