Fixed Sonar Bugs & Vulnerabilities 90/127890/2
authorsharath reddy <bs.reddy@huawei.com>
Fri, 18 Mar 2022 14:41:27 +0000 (20:11 +0530)
committersharath reddy <bs.reddy@huawei.com>
Tue, 22 Mar 2022 06:53:56 +0000 (12:23 +0530)
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>
framework/src/main/java/org/onap/cli/fw/store/OnapCommandExecutionStore.java
framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java
framework/src/test/java/org/onap/cli/fw/input/cache/OnapCommandParameterCacheTest.java
products/sample/src/main/resources/open-cli-schema/hello-world-http.yaml
profiles/command/src/main/java/org/onap/cli/fw/cmd/cmd/OpenCommandShellCmd.java
profiles/http/src/main/java/org/onap/cli/fw/http/conf/OnapCommandHttpConstants.java

index 8f99819..e72327f 100644 (file)
@@ -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");
         }
 
index 53cea2b..af3a0e4 100644 (file)
@@ -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;
                 }
             }
index 70c89d8..e4dafba 100644 (file)
@@ -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"));
     }
index 8cad866..a9848e7 100644 (file)
@@ -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
index 3bb2606..632142a 100644 (file)
@@ -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) {
index 7ab7928..9b61653 100644 (file)
@@ -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";