diff options
author | Arindam Mondal <arind.mondal@samsung.com> | 2019-06-28 18:21:49 +0900 |
---|---|---|
committer | arindamm <arind.mondal@samsung.com> | 2019-06-28 18:32:23 +0900 |
commit | 1bafec84c1e0f02f6bd1574166d403e4e67406d8 (patch) | |
tree | d43700646e9c2dbfef0d27d51300b9e863ce53e3 | |
parent | 716f13b2bd55f8020cdabcc47ab7a3179b997063 (diff) |
General sonar fixes
+) remove unused imports
++) use isEmpty to check empty list
Issue-ID: CLI-170
Change-Id: I90cc07013b8db1982fdca2ccd2f4d715d8176e9d
Signed-off-by: arindamm <arind.mondal@samsung.com>
4 files changed, 3 insertions, 10 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/cmd/OnapCommand.java b/framework/src/main/java/org/onap/cli/fw/cmd/OnapCommand.java index dbd24630..b814ba82 100644 --- a/framework/src/main/java/org/onap/cli/fw/cmd/OnapCommand.java +++ b/framework/src/main/java/org/onap/cli/fw/cmd/OnapCommand.java @@ -179,6 +179,7 @@ public abstract class OnapCommand { try { return new ObjectMapper().writeValueAsString(args); } catch (JsonProcessingException e) { + log.error("exception occured {}", e.getMessage()); return "{}"; } } diff --git a/framework/src/main/java/org/onap/cli/fw/cmd/schema/OnapSchemaValidateCommand.java b/framework/src/main/java/org/onap/cli/fw/cmd/schema/OnapSchemaValidateCommand.java index 71267ec3..f6ace6d5 100644 --- a/framework/src/main/java/org/onap/cli/fw/cmd/schema/OnapSchemaValidateCommand.java +++ b/framework/src/main/java/org/onap/cli/fw/cmd/schema/OnapSchemaValidateCommand.java @@ -16,10 +16,8 @@ package org.onap.cli.fw.cmd.schema; -import java.util.ArrayList; import java.util.List; import java.util.Map; - import org.onap.cli.fw.cmd.OnapCommand; import org.onap.cli.fw.conf.OnapCommandConstants; import org.onap.cli.fw.error.OnapCommandException; diff --git a/framework/src/main/java/org/onap/cli/fw/output/OnapCommandResult.java b/framework/src/main/java/org/onap/cli/fw/output/OnapCommandResult.java index ca0f04e7..bbe33594 100644 --- a/framework/src/main/java/org/onap/cli/fw/output/OnapCommandResult.java +++ b/framework/src/main/java/org/onap/cli/fw/output/OnapCommandResult.java @@ -20,14 +20,11 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; - import org.onap.cli.fw.conf.OnapCommandConstants; import org.onap.cli.fw.error.OnapCommandException; import org.onap.cli.fw.error.OnapCommandOutputFormatNotsupported; import org.onap.cli.fw.error.OnapCommandOutputPrintingFailed; -import org.onap.cli.fw.input.OnapCommandParameterType; import org.onap.cli.fw.output.print.OnapCommandPrint; -import org.onap.cli.fw.utils.OnapCommandUtils; /** * Oclip Command result holds the final output of the command. diff --git a/profiles/http/src/main/java/org/onap/cli/fw/http/connect/OnapHttpConnection.java b/profiles/http/src/main/java/org/onap/cli/fw/http/connect/OnapHttpConnection.java index aa37e839..a2da0706 100644 --- a/profiles/http/src/main/java/org/onap/cli/fw/http/connect/OnapHttpConnection.java +++ b/profiles/http/src/main/java/org/onap/cli/fw/http/connect/OnapHttpConnection.java @@ -27,11 +27,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; - import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; - import org.apache.http.Header; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; @@ -56,7 +54,6 @@ import org.apache.http.conn.ssl.X509HostnameVerifier; import org.apache.http.cookie.Cookie; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; -import org.apache.http.entity.mime.MultipartEntity; import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.impl.client.BasicCookieStore; import org.apache.http.impl.client.HttpClients; @@ -294,7 +291,7 @@ public class OnapHttpConnection { HttpRequestBase requestBase = null; if ("post".equals(input.getMethod())) { HttpPost httpPost = new HttpPost(); - if (input.isBinaryData() || input.getMultiparts().size() > 0) { + if (input.isBinaryData() || !(input.getMultiparts().isEmpty())) { httpPost.setEntity(getMultipartEntity(input)); } else { httpPost.setEntity(this.getStringEntity(input)); @@ -367,7 +364,7 @@ public class OnapHttpConnection { } private HttpEntity getMultipartEntity(HttpInput input) { - if (input.getMultiparts().size() > 0) { + if (!input.getMultiparts().isEmpty()) { MultipartEntityBuilder entityBuilder = MultipartEntityBuilder.create(); for (HttpInput.Part part: input.getMultiparts()) { if (part.isBinary()) { |