summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorLiam Fallon <liam.fallon@est.tech>2021-06-20 19:39:39 +0000
committerGerrit Code Review <gerrit@onap.org>2021-06-20 19:39:39 +0000
commitf00ca4de37bbbf272e107dd89f4dbb901c787462 (patch)
tree419f19cfffa1a49e5a4be4b80d75cfc740c26cf0 /common
parent18526e9a01fc0b0e085d2a6e3457957e6392ce27 (diff)
parent2d186df9e3ed47599dbc86c2f435f7884535398c (diff)
Merge "Clean up CLAMP Sonar and checkstyle issues"
Diffstat (limited to 'common')
-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");