From 7a5e16b2c0814374f5fd1b10e8826d4ec2e775e9 Mon Sep 17 00:00:00 2001 From: Marek Gradzki Date: Fri, 4 Mar 2016 07:55:07 +0100 Subject: 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 --- .../src/main/java/io/fd/honeycomb/v3po/impl/V3poApiRequest.java | 9 ++++++--- .../main/java/io/fd/honeycomb/v3po/impl/VppPollOperDataImpl.java | 8 +++++--- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'v3po/impl') 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 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); -- cgit 1.2.3-korg