From 9a798c537eaeca45118724209c4136e838255b08 Mon Sep 17 00:00:00 2001 From: Daan Hoogland Date: Tue, 15 Sep 2015 20:36:53 +0200 Subject: [PATCH 1/2] findbugs: instead of !=, use string utils --- .../src/com/cloud/network/bigswitch/BigSwitchBcfApi.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApi.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApi.java index 16cb3f70fc7..2e9c0fa9483 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApi.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApi.java @@ -47,6 +47,7 @@ import org.apache.commons.httpclient.methods.PutMethod; import org.apache.commons.httpclient.methods.StringRequestEntity; import org.apache.commons.httpclient.protocol.Protocol; import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; +import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import com.google.gson.Gson; @@ -296,7 +297,7 @@ public class BigSwitchBcfApi { m.setRequestHeader(CONTENT_TYPE, CONTENT_JSON); m.setRequestHeader(ACCEPT, CONTENT_JSON); m.setRequestHeader(HTTP_HEADER_INSTANCE_ID, CLOUDSTACK_INSTANCE_ID + "-" + zoneId); - if (hash != "" ) { + if (StringUtils.isNotEmpty(hash)) { m.setRequestHeader(HASH_MATCH, hash); } From 3d5f09357b21bd115fb1e6d5c2ad1b743b2bf90c Mon Sep 17 00:00:00 2001 From: Daan Hoogland Date: Mon, 2 Nov 2015 11:29:03 +0100 Subject: [PATCH 2/2] use equals instead of comparison operators on strings --- .../src/com/cloud/network/bigswitch/BigSwitchBcfApi.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApi.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApi.java index 2e9c0fa9483..c1d10dd3086 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApi.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApi.java @@ -401,10 +401,10 @@ public class BigSwitchBcfApi { gm.releaseConnection(); } if(returnValue instanceof ControlClusterStatus) { - if(hash == HASH_CONFLICT) { + if(HASH_CONFLICT.equals(hash)) { isMaster = true; ((ControlClusterStatus) returnValue).setTopologySyncRequested(true); - } else if (hash != HASH_IGNORE && !isMaster) { + } else if (!HASH_IGNORE.equals(hash) && !isMaster) { isMaster = true; ((ControlClusterStatus) returnValue).setTopologySyncRequested(true); }