From: Madhu Venugopal Date: Tue, 18 Jun 2013 07:51:11 +0000 (-0700) Subject: The reverse method in Match clones the current object and swaps the reversible match... X-Git-Tag: releasepom-0.1.0~346 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=7b27698bf8a0627c2935bb183b6a532fc6a8a429 The reverse method in Match clones the current object and swaps the reversible match fields. While doing so, it fails to reset the field in the cloned object if the corresponding reversible field is not present. Change-Id: I0a2356ac9d4f0306f77afa2c3aa7908277c4c30e Signed-off-by: Madhu Venugopal --- 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..4dcf2b3c37 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 @@ -225,13 +225,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); + } } }