X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fsal%2Fapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fmatch%2FMatch.java;h=2ead8cdbc4b7e645b6d6a0a6d0ae8039c08923f2;hb=b4f7106f7b4267b51701eff2d3499c0e12423048;hp=736314caedc2cb535a9e8160e3d056789e2d67c5;hpb=cffdfafd2b23b24025f5ba4b32f16bca501bfeb5;p=controller.git diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/match/Match.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/match/Match.java index 736314caed..2ead8cdbc4 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/match/Match.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/match/Match.java @@ -26,8 +26,6 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import org.opendaylight.controller.sal.utils.EtherTypes; import org.opendaylight.controller.sal.utils.IPProtocols; import org.opendaylight.controller.sal.utils.NetUtils; @@ -293,10 +291,8 @@ public class Match implements Cloneable, Serializable { && filterAddress instanceof Inet4Address) { return true; } - InetAddress thisMask = (InetAddress) filter.getField(type) - .getMask(); - InetAddress filterMask = (InetAddress) filter.getField(type) - .getMask(); + InetAddress thisMask = (InetAddress) thisField.getMask(); + InetAddress filterMask = (InetAddress) filterField.getMask(); // thisAddress has to be in same subnet of filterAddress if (NetUtils.inetAddressConflict(thisAddress, filterAddress, thisMask, filterMask)) { @@ -339,12 +335,30 @@ public class Match implements Cloneable, Serializable { @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + final int prime = 31; + int result = 1; + result = prime * result + ((fields == null) ? 0 : fields.hashCode()); + result = prime * result + matches; + return result; } @Override public boolean equals(Object obj) { - return EqualsBuilder.reflectionEquals(this, obj); + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Match other = (Match) obj; + if (fields == null) { + if (other.fields != null) + return false; + } else if (!fields.equals(other.fields)) + return false; + if (matches != other.matches) + return false; + return true; } @Override