CLOUDSTACK-8656: return false from equals if not the same class

why ignore the exception and then return false anyway?
This commit is contained in:
Daan Hoogland 2015-08-04 14:38:48 +02:00
parent 21fd2b9b8e
commit 87fb09997d
1 changed files with 5 additions and 1 deletions

View File

@ -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<ModelReference>, 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() {