Avoid unnecessary state transition
Change state from WithdrawRequest to Withdrawn directly when
there is nothing in the store with the key
Change-Id: Ia38d02bcff8df7aad35fbb975843c6741ff540f4
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/WithdrawCoordinating.java b/core/net/src/main/java/org/onosproject/net/intent/impl/WithdrawCoordinating.java
index 5860d80..2515a35 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/WithdrawCoordinating.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/WithdrawCoordinating.java
@@ -17,7 +17,6 @@
import org.onosproject.net.flow.FlowRuleOperations;
import org.onosproject.net.intent.IntentData;
-import org.onosproject.net.intent.IntentState;
import java.util.Optional;
@@ -37,14 +36,11 @@
WithdrawCoordinating(IntentManager intentManager, IntentData pending, IntentData current) {
this.intentManager = checkNotNull(intentManager);
this.pending = checkNotNull(pending);
- this.current = current;
+ this.current = checkNotNull(current);
}
@Override
public Optional<IntentUpdate> execute() {
- if (current == null) { // there's nothing in the store with this key
- return Optional.of(new Withdrawn(pending, IntentState.WITHDRAWN));
- }
FlowRuleOperations flowRules = intentManager.uninstallCoordinate(current, pending);
pending.setInstallables(current.installables());
return Optional.of(new Withdrawing(intentManager, pending, flowRules));