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>
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()