From 2d186df9e3ed47599dbc86c2f435f7884535398c Mon Sep 17 00:00:00 2001 From: liamfallon Date: Wed, 16 Jun 2021 12:08:01 +0100 Subject: Clean up CLAMP Sonar and checkstyle issues This commit cleans up sonar and checkstyle issues identified in the CLAMP repository. Issue-ID: POLICY-3206 Change-Id: I16b61bbe771cc17de15183a24b2a5e82a8d35872 Signed-off-by: liamfallon --- .../common/exception/ControlLoopException.java | 2 +- .../common/startstop/CommonCommandLineArguments.java | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'common/src/main/java') diff --git a/common/src/main/java/org/onap/policy/clamp/controlloop/common/exception/ControlLoopException.java b/common/src/main/java/org/onap/policy/clamp/controlloop/common/exception/ControlLoopException.java index 05b913b22..58b5368a9 100644 --- a/common/src/main/java/org/onap/policy/clamp/controlloop/common/exception/ControlLoopException.java +++ b/common/src/main/java/org/onap/policy/clamp/controlloop/common/exception/ControlLoopException.java @@ -44,7 +44,7 @@ public class ControlLoopException extends Exception implements ErrorResponseInfo /** * Instantiates a new control loop exception. * - * @param statusCode the return code for the exception + * @param statusCode the status code for the response as a HTTP status code * @param message the message on the exception */ public ControlLoopException(final Response.Status statusCode, final String message) { diff --git a/common/src/main/java/org/onap/policy/clamp/controlloop/common/startstop/CommonCommandLineArguments.java b/common/src/main/java/org/onap/policy/clamp/controlloop/common/startstop/CommonCommandLineArguments.java index 3ef3d4cb0..ebc9028f4 100644 --- a/common/src/main/java/org/onap/policy/clamp/controlloop/common/startstop/CommonCommandLineArguments.java +++ b/common/src/main/java/org/onap/policy/clamp/controlloop/common/startstop/CommonCommandLineArguments.java @@ -23,7 +23,6 @@ package org.onap.policy.clamp.controlloop.common.startstop; import java.io.File; import java.io.PrintWriter; import java.io.StringWriter; -import java.net.URL; import javax.ws.rs.core.Response; import org.apache.commons.cli.HelpFormatter; import org.apache.commons.cli.Option; @@ -42,6 +41,8 @@ public class CommonCommandLineArguments { /** * Construct the options for the policy participant. + * + * @param options the options for the command line */ public CommonCommandLineArguments(final Options options) { //@formatter:off @@ -73,6 +74,7 @@ public class CommonCommandLineArguments { /** * Validate the command line options. * + * @param configurationFilePath the path to the configuration file * @throws ControlLoopException on command argument validation errors */ public void validate(final String configurationFilePath) throws ControlLoopException { @@ -92,12 +94,13 @@ public class CommonCommandLineArguments { * Print help information for policy participant. * * @param mainClassName the main class name + * @param options the options for the command * @return the help string */ public String help(final String mainClassName, final Options options) { - final HelpFormatter helpFormatter = new HelpFormatter(); - final StringWriter stringWriter = new StringWriter(); - final PrintWriter printWriter = new PrintWriter(stringWriter); + final var helpFormatter = new HelpFormatter(); + final var stringWriter = new StringWriter(); + final var printWriter = new PrintWriter(stringWriter); helpFormatter.printHelp(printWriter, HELP_LINE_LENGTH, mainClassName + " [options...]", "options", options, 0, 0, ""); @@ -119,13 +122,13 @@ public class CommonCommandLineArguments { } // The file name refers to a resource on the local file system - final URL fileUrl = ResourceUtils.getUrl4Resource(fileName); + final var fileUrl = ResourceUtils.getUrl4Resource(fileName); if (fileUrl == null) { throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, fileTag + FILE_MESSAGE_PREAMBLE + fileName + "\" does not exist"); } - final File theFile = new File(fileUrl.getPath()); + final var theFile = new File(fileUrl.getPath()); if (!theFile.exists()) { throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, fileTag + FILE_MESSAGE_PREAMBLE + fileName + "\" does not exist"); -- cgit 1.2.3-korg