From 4b20f15c9d54b6cf7a8259b70b3e480ad5d95ee8 Mon Sep 17 00:00:00 2001 From: Shigeru Yasuda Date: Tue, 4 Mar 2014 20:07:04 +0900 Subject: [PATCH] Bug fix for equals(Object) in virtual node path classes. Virtual node paths of different types should be treated as different objects even if they have the same path components. Change-Id: If2e6ab3cfc1436b8a14210e63284190c284957f8 Signed-off-by: Shigeru Yasuda --- .../vtn/manager/VBridgeIfPath.java | 34 ++++++++++++++----- .../opendaylight/vtn/manager/VBridgePath.java | 34 ++++++++++++++----- .../opendaylight/vtn/manager/VTenantPath.java | 30 +++++++++++----- .../vtn/manager/VBridgeIfPathTest.java | 12 ++++++- .../vtn/manager/VBridgePathTest.java | 8 ++++- .../manager/internal/cluster/VlanMapPath.java | 26 +++++++++++--- .../internal/cluster/VlanMapPathTest.java | 13 ++++++- 7 files changed, 125 insertions(+), 32 deletions(-) diff --git a/manager/api/src/main/java/org/opendaylight/vtn/manager/VBridgeIfPath.java b/manager/api/src/main/java/org/opendaylight/vtn/manager/VBridgeIfPath.java index 4e058529..4c75dd14 100644 --- a/manager/api/src/main/java/org/opendaylight/vtn/manager/VBridgeIfPath.java +++ b/manager/api/src/main/java/org/opendaylight/vtn/manager/VBridgeIfPath.java @@ -29,7 +29,7 @@ public class VBridgeIfPath extends VBridgePath { /** * Version number for serialization. */ - private static final long serialVersionUID = -5494415245844633625L; + private static final long serialVersionUID = -4217150774548362963L; /** * The name of the @@ -111,6 +111,27 @@ public class VBridgeIfPath extends VBridgePath { return builder; } + /** + * Determine whether all components in the given path equal to components + * in this object or not. + * + * @param path An object to be compared. + * @return {@code true} if all path components in {@code path} are + * identical to components in this object. + * Otherwise {@code false}. + */ + protected final boolean equalsPath(VBridgeIfPath path) { + if (!equalsPath((VBridgePath)path)) { + return false; + } + + if (ifName == null) { + return (path.ifName == null); + } + + return ifName.equals(path.ifName); + } + /** * Determine whether the given object is identical to this object. * @@ -120,6 +141,8 @@ public class VBridgeIfPath extends VBridgePath { *