diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2016-03-04 07:55:07 +0100 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2016-03-18 09:25:12 +0100 |
commit | 7a5e16b2c0814374f5fd1b10e8826d4ec2e775e9 (patch) | |
tree | 86b11eb856e56c427d5b234ecf37e92f92221364 /v3po/impl/src/main | |
parent | 8f645373e32e3265292e437c834acf234679181e (diff) |
Use equals instead of == for String comparison
The same string value may be represented by two different String objects,
so comparison using == may fail.
Change-Id: I6f2f78d082b096baa255ff7836be338f5dd41473
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/impl/src/main')
-rw-r--r-- | v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poApiRequest.java | 9 | ||||
-rw-r--r-- | v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppPollOperDataImpl.java | 8 |
2 files changed, 11 insertions, 6 deletions
diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poApiRequest.java b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poApiRequest.java index 7f614413b..5de4cfdf5 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poApiRequest.java +++ b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poApiRequest.java @@ -16,12 +16,14 @@ package io.fd.honeycomb.v3po.impl; +import com.google.common.base.Preconditions; import com.google.common.net.InetAddresses; import com.google.common.primitives.Ints; import com.google.common.util.concurrent.CheckedFuture; import com.google.common.util.concurrent.Futures; import java.math.BigInteger; import java.net.InetAddress; +import javax.annotation.Nonnull; import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; @@ -173,7 +175,7 @@ public class V3poApiRequest { } private Interface buildStateInterface(final int ifIndex, - final String interfaceName, + @Nonnull final String interfaceName, final int supIfIndex, final byte[] physAddr, final byte adminUp, final byte linkUp, @@ -189,6 +191,7 @@ public class V3poApiRequest { final int vtrOp, final int vtrPushDot1q, final int vtrTag1, final int vtrTag2, final Statistics stats) { + Preconditions.checkNotNull(interfaceName, "interfaceName should not be null"); InterfaceBuilder ifBuilder = new InterfaceBuilder(); Class<? extends InterfaceType> ifType; @@ -232,10 +235,10 @@ public class V3poApiRequest { if (bd != null) { bdName = bd.name; for (vppBridgeDomainInterfaceDetails bdIf : bd.interfaces) { - if (bdIf.interfaceName != interfaceName) { + if (!interfaceName.equals(bdIf.interfaceName)) { continue; } - if (bd.bviInterfaceName == interfaceName) { + if (interfaceName.equals(bd.bviInterfaceName)) { bvi = true; } splitHorizonGroup = bdIf.splitHorizonGroup; diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppPollOperDataImpl.java b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppPollOperDataImpl.java index 64223aaad..e5cb13f81 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppPollOperDataImpl.java +++ b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppPollOperDataImpl.java @@ -96,9 +96,11 @@ public class VppPollOperDataImpl implements V3poService { bd.arpTerm, bd.forward, bd.learn); for (vppBridgeDomainInterfaceDetails bdIf : bd.interfaces) { - bdBuilder.addInterface(bdIf.interfaceName, - bd.bviInterfaceName == bdIf.interfaceName, - bdIf.splitHorizonGroup); + if (bdIf.interfaceName != null) { + bdBuilder.addInterface(bdIf.interfaceName, + bdIf.interfaceName.equals(bd.bviInterfaceName), + bdIf.splitHorizonGroup); + } } vppL2Fib[] bdFibs = l2fibByBdId.get(bdId); |