X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fsal%2Fapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fmatch%2FMatch.java;h=b8f776fc176d49085487d556dcd4e11a353751cd;hb=9438cd96bbebb06f5b67c81f313eacd6e382f0d7;hp=30c25af57f688539c7bf569aa4ecccf0f804af26;hpb=9822a34fdd144aeb9932492e1605715eb472ecad;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 30c25af57f..b8f776fc17 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 @@ -354,7 +354,7 @@ public class Match implements Cloneable, Serializable { .getSubnetMaskLength(thisMask); int otherMaskLen = (otherMask == null) ? ((otherAddress instanceof Inet4Address) ? 32 : 128) : NetUtils .getSubnetMaskLength(otherMask); - if (otherMaskLen < thisMaskLen) { + if (thisMaskLen < otherMaskLen) { intersection.setField(new MatchField(type, NetUtils.getSubnetPrefix(otherAddress, otherMaskLen), otherMask)); } else { @@ -441,7 +441,17 @@ public class Match implements Cloneable, Serializable { public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((fields == null) ? 0 : fields.hashCode()); + if (this.fields == null) { + result = prime * result; + } else { + int sum = 0; + for (MatchType field : this.fields.keySet()) { + MatchField f = this.fields.get(field); + sum = sum + ((field==null ? 0 : field.calculateConsistentHashCode()) ^ + (f==null ? 0 : f.hashCode())); + } + result = prime * result + sum; + } result = prime * result + matches; return result; }