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=9bab8391986df5a82dfc6b3aeeab51155eb84f88;hb=432ddf481f3bb6c297b1353f76a797fc9ef0e454;hp=00a2f57308d57e1d76c8f0e88aeb86d74a3f910a;hpb=ff1b4a79cca00743a00c3b0b1100bd0ab2b2fb31;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 00a2f57308..9bab839198 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 @@ -202,6 +202,7 @@ public class Match implements Cloneable, Serializable { Match cloned = null; try { cloned = (Match) super.clone(); + cloned.matches = matches; cloned.fields = new HashMap(); for (Entry entry : this.fields.entrySet()) { cloned.fields.put(entry.getKey(), entry.getValue().clone()); @@ -225,13 +226,14 @@ public class Match implements Cloneable, Serializable { Match reverse = this.clone(); // Flip symmetric fields - for (Map.Entry entry : Match.reversableMatches - .entrySet()) { + for (Map.Entry entry : Match.reversableMatches.entrySet()) { MatchType from = entry.getKey(); MatchType to = entry.getValue(); if (this.isPresent(from)) { - reverse.setField(to, this.getField(from).getValue(), this - .getField(from).getMask()); + reverse.setField(to, this.getField(from).getValue(), this.getField(from).getMask()); + if (!this.isPresent(to)) { + reverse.clearField(from); + } } } @@ -344,20 +346,26 @@ public class Match implements Cloneable, Serializable { @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; + } Match other = (Match) obj; if (fields == null) { - if (other.fields != null) + if (other.fields != null) { return false; - } else if (!fields.equals(other.fields)) + } + } else if (!fields.equals(other.fields)) { return false; - if (matches != other.matches) + } + if (matches != other.matches) { return false; + } return true; }