From 1bafec84c1e0f02f6bd1574166d403e4e67406d8 Mon Sep 17 00:00:00 2001 From: Arindam Mondal Date: Fri, 28 Jun 2019 18:21:49 +0900 Subject: General sonar fixes +) remove unused imports ++) use isEmpty to check empty list Issue-ID: CLI-170 Change-Id: I90cc07013b8db1982fdca2ccd2f4d715d8176e9d Signed-off-by: arindamm --- .../main/java/org/onap/cli/fw/http/connect/OnapHttpConnection.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'profiles/http') 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()) { -- cgit 1.2.3-korg