aboutsummaryrefslogtreecommitdiffstats
path: root/common/src/main
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2021-06-16 12:08:01 +0100
committerliamfallon <liam.fallon@est.tech>2021-06-17 15:51:34 +0100
commit2d186df9e3ed47599dbc86c2f435f7884535398c (patch)
treed77b85e48927ad072248e784c7b99b12205f4e0b /common/src/main
parent17f5d3c97e47064407452122bc6cb801e43df5f9 (diff)
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 <liam.fallon@est.tech>
Diffstat (limited to 'common/src/main')
-rw-r--r--common/src/main/java/org/onap/policy/clamp/controlloop/common/exception/ControlLoopException.java2
-rw-r--r--common/src/main/java/org/onap/policy/clamp/controlloop/common/startstop/CommonCommandLineArguments.java15
2 files changed, 10 insertions, 7 deletions
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");