Fix errors in serializers and deserializers
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / protocol / deserialization / match / ArpTargetHardwareAddressEntryDeserializer.java
index bb59ef2d259202ec34c2f9244432af40f69ca667..595c5f315f1abed1c5ee0552a11dfd7c9bf67ddd 100644 (file)
@@ -34,12 +34,13 @@ public class ArpTargetHardwareAddressEntryDeserializer extends AbstractMatchEntr
             builder.setLayer3Match(new ArpMatchBuilder()
                     .setArpTargetHardwareAddress(arpBuilder.build())
                     .build());
-        } else if (ArpMatch.class.isInstance(layer3Match)) {
+        } else if (ArpMatch.class.isInstance(layer3Match)
+            && Objects.isNull(ArpMatch.class.cast(layer3Match).getArpTargetHardwareAddress())) {
             builder.setLayer3Match(new ArpMatchBuilder(ArpMatch.class.cast(layer3Match))
                     .setArpTargetHardwareAddress(arpBuilder.build())
                     .build());
         } else {
-            throwErrorOnMalformed(builder, "layer3Match");
+            throwErrorOnMalformed(builder, "layer3Match", "arpTargetHardwareAddress");
         }
     }