Bug fix - Do not create new next-objective if there are no
non-duplicate buckets to add.

Change-Id: I5bbf3f22225ae91efeed7f5987e771de209f725c
diff --git a/drivers/default/src/main/java/org/onosproject/driver/pipeline/Ofdpa2GroupHandler.java b/drivers/default/src/main/java/org/onosproject/driver/pipeline/Ofdpa2GroupHandler.java
index 8637e0b..c93ad9b 100644
--- a/drivers/default/src/main/java/org/onosproject/driver/pipeline/Ofdpa2GroupHandler.java
+++ b/drivers/default/src/main/java/org/onosproject/driver/pipeline/Ofdpa2GroupHandler.java
@@ -1073,11 +1073,14 @@
             }
         });
 
-        if (!duplicateBuckets.isEmpty()) {
-            log.debug("Some buckets {} already exists in next id {}, duplicate buckets will be ignored.",
-                     duplicateBuckets, nextObjective.id());
-
-            // new next objective with new treatments
+        if (duplicateBuckets.isEmpty()) {
+            // use the original objective
+            objectiveToAdd = nextObjective;
+        } else if (!nonDuplicateBuckets.isEmpty()) {
+            // only use the non-duplicate buckets if there are any
+            log.debug("Some buckets {} already exist in next id {}, duplicate "
+                    + "buckets will be ignored.", duplicateBuckets, nextObjective.id());
+            // new next objective with non duplicate treatments
             NextObjective.Builder builder = DefaultNextObjective.builder()
                     .withType(nextObjective.type())
                     .withId(nextObjective.id())
@@ -1088,7 +1091,8 @@
             ObjectiveContext context = nextObjective.context().orElse(null);
             objectiveToAdd = builder.addToExisting(context);
         } else {
-            objectiveToAdd = nextObjective;
+            // buckets to add are already there - nothing to do
+            return;
         }
 
         if (nextObjective.type() == NextObjective.Type.HASHED) {