From 6a9b54b275feff5369419a86997e94d0a95fc48e Mon Sep 17 00:00:00 2001 From: "waqas.ikram" Date: Thu, 7 Jun 2018 16:01:35 +0100 Subject: Fixing Sonar bugs and Vulnerabilities Change-Id: Id5a95f23f1308dbb9f7f0c0f5567e238ecf830af Issue-ID: POLICY-859 Signed-off-by: waqas.ikram --- .../org/onap/policy/apex/auth/clieditor/ApexCLIEditorMain.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'auth/cli-editor/src/main/java/org') diff --git a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/ApexCLIEditorMain.java b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/ApexCLIEditorMain.java index 4a2635efa..cb1a92eaf 100644 --- a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/ApexCLIEditorMain.java +++ b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/ApexCLIEditorMain.java @@ -78,7 +78,6 @@ public class ApexCLIEditorMain { // Read the command definitions try { commands = new JSONHandler().read(CLICommands.class, parameters.getMetadataStream()); - LOGGER.debug("found " + commands.getCommandSet().size() + " commands"); } catch (final Exception e) { LOGGER.error("start of Apex command line editor failed, error reading command metadata from " + parameters.getMetadataLocation()); @@ -88,18 +87,19 @@ public class ApexCLIEditorMain { } // The JSON processing returns null if there is an empty file - if (null == commands) { + if (commands == null || commands.getCommandSet().isEmpty()) { LOGGER.error("start of Apex command line editor failed, no commands found in " + parameters.getApexPropertiesLocation()); errorCount++; return; } + LOGGER.debug("found " + commands.getCommandSet().size() + " commands"); + // Read the Apex properties try { apexModelProperties = new JSONHandler().read(ApexModelProperties.class, parameters.getApexPropertiesStream()); - LOGGER.debug("model properties are: " + apexModelProperties.toString()); } catch (final Exception e) { LOGGER.error("start of Apex command line editor failed, error reading Apex model properties from " + parameters.getApexPropertiesLocation()); @@ -116,6 +116,8 @@ public class ApexCLIEditorMain { return; } + LOGGER.debug("model properties are: " + apexModelProperties.toString()); + // Find the system commands final Set systemCommandNodes = new TreeSet<>(); for (final CLICommand command : commands.getCommandSet()) { -- cgit 1.2.3-korg