Fix errors in serializers and deserializers
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / protocol / deserialization / match / SctpDestinationPortEntryDeserializer.java
index 1995043276e84902bafc2a09ca046866569ad322..2b7dfbaf279a80f57813609d1eebe2edd9d6cfb1 100644 (file)
@@ -26,12 +26,13 @@ public class SctpDestinationPortEntryDeserializer extends AbstractMatchEntryDese
             builder.setLayer4Match(new SctpMatchBuilder()
                     .setSctpDestinationPort(new PortNumber(port))
                     .build());
-        } else if (SctpMatch.class.isInstance(builder.getLayer4Match())) {
+        } else if (SctpMatch.class.isInstance(builder.getLayer4Match())
+            && Objects.isNull(SctpMatch.class.cast(builder.getLayer4Match()).getSctpDestinationPort())) {
             builder.setLayer4Match(new SctpMatchBuilder(SctpMatch.class.cast(builder.getLayer4Match()))
                     .setSctpDestinationPort(new PortNumber(port))
                     .build());
         } else {
-            throwErrorOnMalformed(builder, "layer4Match");
+            throwErrorOnMalformed(builder, "layer4Match", "sctpDestinationPort");
         }
     }