summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2016-03-04 07:55:07 +0100
committerMarek Gradzki <mgradzki@cisco.com>2016-03-18 09:25:12 +0100
commite64fce545f20b3254ea2817437e7d29ef54af019 (patch)
treef0f98ece48efd297629c5086f0b6a3082475557b
parentb003251dec07f42b53e62080625bebe4f9942267 (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>
-rw-r--r--v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poApiRequest.java9
-rw-r--r--v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppPollOperDataImpl.java8
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);