sonar critical for Use the original value 63/25863/1
authorSoumendu Sekhar Acharya <sa00498080@techmahindra.com>
Fri, 8 Dec 2017 09:06:13 +0000 (14:36 +0530)
committerSoumendu Sekhar Acharya <sa00498080@techmahindra.com>
Fri, 8 Dec 2017 09:07:41 +0000 (14:37 +0530)
Checked for non zero
Sonar Link:
https://sonar.onap.org/component_issues/index?id=org.onap.dmaap.messagerouter.dmaapclient%3AdmaapClient#assignees=__me__%2Csoumendu|resolved=false
Location:
src/main/java/com/att/nsa/mr/client/HostSelector.java
Line No-70

Change-Id: I60f07f464c81deffd747d852f8388404b9e97f00
Issue-ID: DMAAP-180
Signed-off-by: Soumendu Sekhar Acharya <sa00498080@techmahindra.com>
src/main/java/com/att/nsa/mr/client/HostSelector.java

index 5a77244..4174cbc 100644 (file)
@@ -66,16 +66,17 @@ public class HostSelector
     if (signature == null) {
       return;
     }
-    if(signature!=null && !baseHosts.isEmpty()) {
-    int index = Math.abs(signature.hashCode()) % baseHosts.size();
-
+    int index = 0 ;
+    int value = signature.hashCode();
+    if(value!=0) {
+    index = Math.abs(value) % baseHosts.size();
+    }
     Iterator it = this.fBaseHosts.iterator();
     while (index-- > 0)
     {
       it.next();
     }
     this.fIdealHost = ((String)it.next());
-    }
   }
 
   public String selectBaseHost()