diff options
author | liamfallon <liam.fallon@ericsson.com> | 2018-09-22 21:07:43 +0100 |
---|---|---|
committer | liamfallon <liam.fallon@ericsson.com> | 2018-09-22 21:15:22 +0100 |
commit | 6973ec9109fd2651e2284663b6c8039bd830a677 (patch) | |
tree | f1f02ef9e5400805e6c2179dc539ad15c3ce5334 /tools | |
parent | a02548ec2e98a8a13cd76ecc83379b13cd26030b (diff) |
Fix sonar problems in Apex
Fixed some easy to resolve Sonar issues.
Issue-ID: POLICY-1034
Change-Id: Ia8e4606bd4307daca499b4a74c96135211e572fd
Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'tools')
4 files changed, 10 insertions, 22 deletions
diff --git a/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Application.java b/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Application.java index 70436150c..34ab414d7 100644 --- a/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Application.java +++ b/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Application.java @@ -24,12 +24,9 @@ import java.io.PrintStream; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.HelpFormatter; -import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.tools.common.CliOptions; import org.onap.policy.apex.tools.common.CliParser; import org.onap.policy.apex.tools.common.OutputFile; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * Process an Apex Policy Model file to generate the CLI commands to generate an equivalent Apex Policy Model. @@ -37,9 +34,6 @@ import org.slf4j.LoggerFactory; * @author Sven van der Meer <sven.van.der.meer@ericsson.com> */ public final class Application { - // Get a reference to the logger - private static final Logger LOGGER = LoggerFactory.getLogger(Application.class); - /** The name of the application. */ public static final String APP_NAME = "gen-model2cli"; @@ -125,13 +119,7 @@ public final class Application { OUT_STREAM.println(); } - try { - final Model2Cli app = new Model2Cli(modelFile, outfile, !cmd.hasOption("sv"), APP_NAME); - app.runApp(); - } catch (final ApexException aex) { - String message = APP_NAME + ": caught APEX exception with message: " + aex.getMessage(); - ERR_STREAM.println(message); - LOGGER.warn(message, aex); - } + final Model2Cli app = new Model2Cli(modelFile, outfile, !cmd.hasOption("sv"), APP_NAME); + app.runApp(); } } diff --git a/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2Cli.java b/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2Cli.java index f58faf0eb..01434190b 100644 --- a/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2Cli.java +++ b/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2Cli.java @@ -108,7 +108,7 @@ public class Model2Cli { * version), negative integer for errors * @throws ApexException if any problem occurred in the model */ - public int runApp() throws ApexException { + public int runApp() { final CodeGeneratorCliEditor codeGen = new CodeGeneratorCliEditor(); final ApexModelFactory factory = new ApexModelFactory(); diff --git a/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2event/Application.java b/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2event/Application.java index a5600ead1..c7fc5e115 100644 --- a/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2event/Application.java +++ b/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2event/Application.java @@ -45,14 +45,14 @@ public final class Application { /** The description 1-liner of the application. */ public static final String APP_DESCRIPTION = "generates JSON templates for events generated from a policy model"; - /** Private constructor to prevent instantiation. */ - private Application() { - } - // Input and output streams private static final PrintStream OUT_STREAM = System.out; private static final PrintStream ERR_STREAM = System.err; + /** Private constructor to prevent instantiation. */ + private Application() { + } + /** * Main method to start the application. * diff --git a/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/CliOptions.java b/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/CliOptions.java index aea984fb1..122ec90a9 100644 --- a/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/CliOptions.java +++ b/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/CliOptions.java @@ -29,9 +29,6 @@ import org.apache.commons.cli.Option; */ public final class CliOptions { - /** Private constructor to prevent instantiation. */ - private CliOptions() {} - /** A console option with "-c" and "--console". */ public static final Option CONSOLE = Option.builder("c").longOpt("console").desc("application as console with input from standard in").build(); @@ -103,4 +100,7 @@ public final class CliOptions { /** A skip validation option with "-sv" and "--skip-validation". */ public static final Option SKIPVALIDATION = Option.builder("sv").longOpt("skip-validation") .desc("switch of validation of the input file").required(false).type(boolean.class).build(); + + /** Private constructor to prevent instantiation. */ + private CliOptions() {} } |