diff options
author | Soumendu Sekhar Acharya <sa00498080@techmahindra.com> | 2017-12-08 14:36:13 +0530 |
---|---|---|
committer | Soumendu Sekhar Acharya <sa00498080@techmahindra.com> | 2017-12-08 14:37:41 +0530 |
commit | 0497d0508a62ff513ff6883c2f6e1947da968d37 (patch) | |
tree | 380db9459237c5e4d84b972ab0248b498fe933a4 /src | |
parent | b21a9dfab099a90c2ad4187938ee03f7f97ff26e (diff) |
sonar critical for Use the original value
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/att/nsa/mr/client/HostSelector.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main/java/com/att/nsa/mr/client/HostSelector.java b/src/main/java/com/att/nsa/mr/client/HostSelector.java index 5a77244..4174cbc 100644 --- a/src/main/java/com/att/nsa/mr/client/HostSelector.java +++ b/src/main/java/com/att/nsa/mr/client/HostSelector.java @@ -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() |