From 1b9f8877186932d84c5ed4405aa0d73242d33cdf Mon Sep 17 00:00:00 2001 From: SravanKumarGunda Date: Tue, 4 Aug 2020 21:02:32 +0530 Subject: code improvements-sonar fixes Signed-off-by: SravanKumarGunda Issue-ID: CLI-270 Change-Id: I3f663df51e27e7295f9cad51ace100d784ab94bb --- .../java/org/onap/cli/fw/error/OnapCommandInvalidRegistration.java | 2 +- .../src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java | 2 +- .../src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java | 4 ++++ .../main/java/org/onap/cli/fw/store/OnapCommandExecutionStore.java | 3 +-- .../main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) (limited to 'framework/src/main') diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidRegistration.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidRegistration.java index 1c90e9a0..90f8c468 100644 --- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidRegistration.java +++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidRegistration.java @@ -26,7 +26,7 @@ public class OnapCommandInvalidRegistration extends OnapCommandException { private static final long serialVersionUID = 7722163282274482532L; - public OnapCommandInvalidRegistration(Class cls) { + public OnapCommandInvalidRegistration(Class cls) { super("0x2001", "Invalid commad class " + cls.getCanonicalName() + " registration, it should be derived from " + OnapCommand.class.getCanonicalName()); } diff --git a/framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java b/framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java index 09050c6c..c548f6dc 100644 --- a/framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java +++ b/framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java @@ -290,6 +290,6 @@ public class OnapCommandPrint { throw new OnapCommandOutputPrintingFailed(e); // NOSONAR } */ - return ""; + return ""; //NOSONAR } } diff --git a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java index 9a6a4e78..0712603a 100644 --- a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java +++ b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java @@ -35,6 +35,10 @@ public class OnapCommandSchemaMerger { static Logger logger = LoggerFactory.getLogger(OnapCommandSchemaMerger.class); + private OnapCommandSchemaMerger(){ + //It is made private in order to resolve: Utility classes should not have public constructors + } + public static Map mergeSchemas(OnapCommand cmd) throws OnapCommandException { Map mergedResult = new LinkedHashMap<>(); diff --git a/framework/src/main/java/org/onap/cli/fw/store/OnapCommandExecutionStore.java b/framework/src/main/java/org/onap/cli/fw/store/OnapCommandExecutionStore.java index 839d1427..774e1fd7 100644 --- a/framework/src/main/java/org/onap/cli/fw/store/OnapCommandExecutionStore.java +++ b/framework/src/main/java/org/onap/cli/fw/store/OnapCommandExecutionStore.java @@ -453,8 +453,7 @@ public class OnapCommandExecutionStore { private File getExecutionDir(String executionId) throws OnapCommandExecutionNotFound { File []f = new File(getBasePath()).listFiles((dir, name) -> { - if (name.startsWith(executionId)) return true; - return false; + return name.startsWith(executionId); }); if (f.length == 0) { diff --git a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java index 614eb2a9..923ae243 100644 --- a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java +++ b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java @@ -480,7 +480,7 @@ public class OnapCommandDiscoveryUtils { public static List> createTestSuite(String cmd, String version) throws OnapCommandException { - ArrayList> testSamples = new ArrayList(); + ArrayList> testSamples = new ArrayList<>(); List resources = new ArrayList<>(); -- cgit 1.2.3-korg