From cd68fc9bae7d6258f77ff59c1431e4f925f61a4c Mon Sep 17 00:00:00 2001 From: liamfallon Date: Thu, 13 Sep 2018 23:48:50 +0100 Subject: 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 --- .../policy/apex/auth/clieditor/CommandLineEditorLoop.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'auth') 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 argument : getCommandArguments(commandWords)) { final List> 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"); } -- cgit 1.2.3-korg