From 87fb09997df3d2451c1cf68a2a10874f643c0dea Mon Sep 17 00:00:00 2001 From: Daan Hoogland Date: Tue, 4 Aug 2015 14:38:48 +0200 Subject: [PATCH] CLOUDSTACK-8656: return false from equals if not the same class why ignore the exception and then return false anyway? --- .../cloudstack/network/contrail/model/ModelObject.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/ModelObject.java b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/ModelObject.java index c751d75b63c..acfff7de291 100644 --- a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/ModelObject.java +++ b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/ModelObject.java @@ -22,6 +22,8 @@ import java.io.Serializable; import java.lang.ref.WeakReference; import java.util.TreeSet; +import org.apache.log4j.Logger; + import com.cloud.exception.InternalErrorException; /** @@ -43,6 +45,7 @@ public interface ModelObject { public static class ModelReference implements Comparable, Serializable { private static final long serialVersionUID = -2019113974956703526L; + private static final Logger s_logger = Logger.getLogger(ModelReference.class); /* * WeakReference class is not serializable by definition. So, we cannot enforce its serialization unless we write the implementation of @@ -86,8 +89,9 @@ public interface ModelObject { ModelReference rhs = (ModelReference)other; return compareTo(rhs) == 0; } catch (ClassCastException ex) { + // not this class , so + return false; } - return false; } public ModelObject get() {