Brian O'Connor

ONOS-5309 Clearing installables from intent data object on successful uninstallation

Change-Id: Ic77af12f98bc1519efb2e2703223e340aa5b20e4
(cherry picked from commit 24389970)
......@@ -114,7 +114,8 @@ public class IntentData { //FIXME need to make this "immutable"
public IntentData(IntentData original, List<Intent> installables) {
this(original);
this.installables = ImmutableList.copyOf(checkNotNull(installables));
this.installables = checkNotNull(installables).isEmpty() ?
Collections.emptyList() : ImmutableList.copyOf(installables);
}
// kryo constructor
......
......@@ -36,6 +36,7 @@ import org.slf4j.Logger;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;
......@@ -112,7 +113,8 @@ class IntentInstaller {
uninstallData.setState(WITHDRAWN);
break;
}
store.write(uninstallData);
// Intent has been withdrawn; we can clear the installables
store.write(new IntentData(uninstallData, Collections.emptyList()));
}
};
......