ONOS-2025 Corrected a logic error in the flow rule store that crept in during a recent refactor. (175e8fde54342d3f9440134bf06a1c2ffcb99acc)

Change-Id: I4a4cb097ba7aa23dd00ebe59e8ebbbff68630dae
diff --git a/core/store/dist/src/main/java/org/onosproject/store/flow/impl/NewDistributedFlowRuleStore.java b/core/store/dist/src/main/java/org/onosproject/store/flow/impl/NewDistributedFlowRuleStore.java
index 888f95b..b691e80 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/flow/impl/NewDistributedFlowRuleStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/flow/impl/NewDistributedFlowRuleStore.java
@@ -412,16 +412,18 @@
                                     SERIALIZER::encode,
                                     master)
                            .whenComplete((result, error) -> {
-                               log.warn("Failed to storeBatch: {} to {}", operation, master);
+                               if (error != null) {
+                                   log.warn("Failed to storeBatch: {} to {}", operation, master);
 
-                               Set<FlowRule> allFailures = operation.getOperations()
-                                                                    .stream()
-                                                                    .map(op -> op.target())
-                                                                    .collect(Collectors.toSet());
+                                   Set<FlowRule> allFailures = operation.getOperations()
+                                           .stream()
+                                           .map(op -> op.target())
+                                           .collect(Collectors.toSet());
 
-                               notifyDelegate(FlowRuleBatchEvent.completed(
-                                       new FlowRuleBatchRequest(operation.id(), Collections.emptySet()),
-                                       new CompletedBatchOperation(false, allFailures, deviceId)));
+                                   notifyDelegate(FlowRuleBatchEvent.completed(
+                                           new FlowRuleBatchRequest(operation.id(), Collections.emptySet()),
+                                           new CompletedBatchOperation(false, allFailures, deviceId)));
+                               }
                            });
     }