aboutsummaryrefslogtreecommitdiffstats
path: root/auth/cli-editor/src
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@ericsson.com>2018-09-13 23:48:50 +0100
committerliamfallon <liam.fallon@ericsson.com>2018-09-13 23:49:32 +0100
commitcd68fc9bae7d6258f77ff59c1431e4f925f61a4c (patch)
tree53054a7c8e8738644785039c3a200c6b23d4b3ed /auth/cli-editor/src
parent4cfa2e2d98f6877d54da304ef17f096284430908 (diff)
Address sonar/Checkstyle Issues
Sweep through Apex codebase to fix most ceheckstyle and straightforward sonar issues. Issue-ID: POLICY-1034 Change-Id: I149d9a94ad893affc93573e8de5e3304b6bdde2d Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'auth/cli-editor/src')
-rw-r--r--auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorLoop.java11
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");
}