aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsharath reddy <bs.reddy@huawei.com>2022-03-18 20:11:27 +0530
committersharath reddy <bs.reddy@huawei.com>2022-03-22 12:23:56 +0530
commit9df5c4d3e3e7b72b54de212a4a97ef18e5930948 (patch)
tree73afa3942fbc09f4c98b1cc57edc2b11d06213e1
parent3a40008342681bfdbd5ac73ac1b4b6a85c7fd8eb (diff)
Fixed Sonar Bugs & Vulnerabilities
Issue-ID: CLI-439 Signed-off-by: sharath reddy <bs.reddy@huawei.com> Change-Id: Icbe3d40286d15b8b3639af7a7eb6c4e189169a3f Signed-off-by: sharath reddy <bs.reddy@huawei.com>
-rw-r--r--framework/src/main/java/org/onap/cli/fw/store/OnapCommandExecutionStore.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java2
-rw-r--r--framework/src/test/java/org/onap/cli/fw/input/cache/OnapCommandParameterCacheTest.java4
-rw-r--r--products/sample/src/main/resources/open-cli-schema/hello-world-http.yaml2
-rw-r--r--profiles/command/src/main/java/org/onap/cli/fw/cmd/cmd/OpenCommandShellCmd.java2
-rw-r--r--profiles/http/src/main/java/org/onap/cli/fw/http/conf/OnapCommandHttpConstants.java2
6 files changed, 7 insertions, 7 deletions
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"));
}
diff --git a/products/sample/src/main/resources/open-cli-schema/hello-world-http.yaml b/products/sample/src/main/resources/open-cli-schema/hello-world-http.yaml
index 8cad8668..a9848e7f 100644
--- a/products/sample/src/main/resources/open-cli-schema/hello-world-http.yaml
+++ b/products/sample/src/main/resources/open-cli-schema/hello-world-http.yaml
@@ -8,7 +8,7 @@ description: |
Try to add new commands to display different weather details by exploring this site.
Sample usage:
- oclip --product tutorial weather-report --host-url http://api.openweathermap.org --zip-code 637301 --country-code in
+ oclip --product tutorial weather-report --host-url https://api.openweathermap.org --zip-code 637301 --country-code in
info:
product: tutorial
diff --git a/profiles/command/src/main/java/org/onap/cli/fw/cmd/cmd/OpenCommandShellCmd.java b/profiles/command/src/main/java/org/onap/cli/fw/cmd/cmd/OpenCommandShellCmd.java
index 3bb2606a..632142af 100644
--- a/profiles/command/src/main/java/org/onap/cli/fw/cmd/cmd/OpenCommandShellCmd.java
+++ b/profiles/command/src/main/java/org/onap/cli/fw/cmd/cmd/OpenCommandShellCmd.java
@@ -211,7 +211,7 @@ public class OpenCommandShellCmd extends OnapCommand {
this.getResult().setDebugInfo(pr.toString());
pr.run();
- } catch (Exception e) {
+ } catch (Exception e) {// NOSONAR
throw new OnapCommandExecutionFailed(this.getName(), e);
} finally {
if (stdoutStream != null) {
diff --git a/profiles/http/src/main/java/org/onap/cli/fw/http/conf/OnapCommandHttpConstants.java b/profiles/http/src/main/java/org/onap/cli/fw/http/conf/OnapCommandHttpConstants.java
index 7ab7928d..9b616533 100644
--- a/profiles/http/src/main/java/org/onap/cli/fw/http/conf/OnapCommandHttpConstants.java
+++ b/profiles/http/src/main/java/org/onap/cli/fw/http/conf/OnapCommandHttpConstants.java
@@ -30,7 +30,7 @@ public class OnapCommandHttpConstants {
public static final String HTTP_REQUEST_MANDATORY_PARAMS = "cli.schema.http.request.sections.mandatory";
public static final String HTTP_METHODS = "cli.schema.http.request.method.values";
//http connection
- public static final String SSLCONTEST_TLS = "TLSV1.2";
+ public static final String SSLCONTEST_TLS = "TLSv1.2";
public static final String APPLICATION_JSON = "application/json";
public static final String DEFAULT_PARAMETER_HTTP_FILE_NAME = "default_input_parameters_http.yaml";
public static final String DEAFULT_PARAMETER_USERNAME = "host-username";