From 9df5c4d3e3e7b72b54de212a4a97ef18e5930948 Mon Sep 17 00:00:00 2001 From: sharath reddy Date: Fri, 18 Mar 2022 20:11:27 +0530 Subject: Fixed Sonar Bugs & Vulnerabilities Issue-ID: CLI-439 Signed-off-by: sharath reddy Change-Id: Icbe3d40286d15b8b3639af7a7eb6c4e189169a3f Signed-off-by: sharath reddy --- .../main/java/org/onap/cli/fw/store/OnapCommandExecutionStore.java | 2 +- .../main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java | 2 +- .../org/onap/cli/fw/input/cache/OnapCommandParameterCacheTest.java | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'framework/src') 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 8f998190..e72327fe 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 @@ -415,7 +415,7 @@ public class OnapCommandExecutionStore { for (String dir: dirs) { list.add(this.makeExecution(dir)); } - } catch (Exception e) { + } catch (Exception e) {// NOSONAR throw new OnapCommandExecutionFailed(e, "Failed to search the executions"); } 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 53cea2b6..af3a0e43 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 @@ -235,7 +235,7 @@ public class OnapCommandDiscoveryUtils { Resource[] resources = OnapCommandDiscoveryUtils.findResources(pattern); if (resources != null && resources.length > 0) { //NOSONAR for (Resource res : resources) { - if (res.getFilename().equals(fileName)) { + if ((res.getFilename() != null) && (res.getFilename().equals(fileName))) { return res; } } diff --git a/framework/src/test/java/org/onap/cli/fw/input/cache/OnapCommandParameterCacheTest.java b/framework/src/test/java/org/onap/cli/fw/input/cache/OnapCommandParameterCacheTest.java index 70c89d88..e4dafba8 100644 --- a/framework/src/test/java/org/onap/cli/fw/input/cache/OnapCommandParameterCacheTest.java +++ b/framework/src/test/java/org/onap/cli/fw/input/cache/OnapCommandParameterCacheTest.java @@ -22,7 +22,7 @@ import java.io.IOException; import org.apache.commons.io.FileUtils; import org.junit.Test; -import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertFalse; public class OnapCommandParameterCacheTest { @Test @@ -31,7 +31,7 @@ public class OnapCommandParameterCacheTest { FileUtils.touch(new File("data" + File.separator + "test-profile.json")); File test_profile = new File("data" + File.separator + "test-profile.json"); FileUtils.touch(test_profile); - assertNotNull(test_profile.lastModified()); + assertFalse(0 == test_profile.lastModified()); //assertTrue(OnapCommandProfileStore.getInstance().getProfiles().contains("test")); // FileUtils.cleanDirectory(new File("data")); } -- cgit 1.2.3-korg