sanitize Boolean autoboxing NPE
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / sal / convertor / FlowConvertor.java
index b0cbfb0a8d5482433a77a2871cfe212b4f1ca4cf..db543037cb767c2600f39bc071995dfc3bc76fd2 100644 (file)
@@ -54,6 +54,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.base.Objects;
+
 /**
  * Utility class for converting a MD-SAL Flow into the OF flow mod
  */
@@ -112,13 +114,13 @@ public class FlowConvertor {
         if (flow instanceof AddFlowInput) {
             flowMod.setCommand(FlowModCommand.OFPFCADD);
         } else if (flow instanceof RemoveFlowInput) {
-            if (flow.isStrict() != null && flow.isStrict()) {
+            if (Objects.firstNonNull(flow.isStrict(), Boolean.FALSE)) {
                 flowMod.setCommand(FlowModCommand.OFPFCDELETESTRICT);
             } else {
                 flowMod.setCommand(FlowModCommand.OFPFCDELETE);
             }
         } else if (flow instanceof UpdatedFlow) {
-            if (flow.isStrict() != null && flow.isStrict()) {
+            if (Objects.firstNonNull(flow.isStrict(), Boolean.FALSE)) {
                 flowMod.setCommand(FlowModCommand.OFPFCMODIFYSTRICT);
             } else {
                 flowMod.setCommand(FlowModCommand.OFPFCMODIFY);