Fix some major sonar issues 45/15545/2
authorsurya-huawei <a.u.surya@huawei.com>
Tue, 26 Sep 2017 13:04:28 +0000 (18:34 +0530)
committerSURYA A U <a.u.surya@huawei.com>
Wed, 27 Sep 2017 03:11:28 +0000 (03:11 +0000)
*Use collection.isEmpty() instead of collection.size
*Remove unnecessary commented line
 This is done for increasing code readability
*Pass the string object directly
 Instead of wrapping the returned object and
 creating a new object, passing the object itself will save
 memory

Issue-Id: SO-118
Change-Id: I24c15e9270ec3422d35d3910a8aff9fcf8d632d9
Signed-off-by: surya-huawei <a.u.surya@huawei.com>
adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/BpelRestClient.java
adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/BpelRestClient.java
mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java

index b7ab504..6c571f3 100644 (file)
@@ -166,7 +166,7 @@ public class BpelRestClient {
        }
 
        public String getRetryList() {
-               if (retryList.size() == 0)
+               if (retryList.isEmpty())
                        return "";
                String t = retryList.toString();
                return t.substring(1, t.length()-1);
index a4f1046..77e5b85 100644 (file)
@@ -234,7 +234,6 @@ public class BpelRestClient {
        }
        private void debug(String m) {
                LOGGER.debug(m);
-//             System.err.println(m);
        }
        private void sendOne(final String toBpelStr, final String bpelUrl, final boolean isxml) {
                LOGGER.debug("Sending to BPEL server: "+bpelUrl);
index a73eec5..cd23991 100644 (file)
@@ -60,7 +60,7 @@ public class BPELRestClient extends RequestClient {
                                                                 CommonConstants.ENCRYPTION_KEY);
                 if (userCredentials != null) {
                     post.addHeader ("Authorization",
-                                    "Basic " + new String (DatatypeConverter.printBase64Binary (userCredentials.getBytes ())));
+                                    "Basic " + DatatypeConverter.printBase64Binary (userCredentials.getBytes ()));
                 }
             }
         }