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" ...@@ -114,7 +114,8 @@ public class IntentData { //FIXME need to make this "immutable"
114 public IntentData(IntentData original, List<Intent> installables) { 114 public IntentData(IntentData original, List<Intent> installables) {
115 this(original); 115 this(original);
116 116
117 - this.installables = ImmutableList.copyOf(checkNotNull(installables)); 117 + this.installables = checkNotNull(installables).isEmpty() ?
118 + Collections.emptyList() : ImmutableList.copyOf(installables);
118 } 119 }
119 120
120 // kryo constructor 121 // kryo constructor
......
...@@ -36,6 +36,7 @@ import org.slf4j.Logger; ...@@ -36,6 +36,7 @@ import org.slf4j.Logger;
36 36
37 import java.util.ArrayList; 37 import java.util.ArrayList;
38 import java.util.Collection; 38 import java.util.Collection;
39 +import java.util.Collections;
39 import java.util.Iterator; 40 import java.util.Iterator;
40 import java.util.List; 41 import java.util.List;
41 import java.util.Optional; 42 import java.util.Optional;
...@@ -112,7 +113,8 @@ class IntentInstaller { ...@@ -112,7 +113,8 @@ class IntentInstaller {
112 uninstallData.setState(WITHDRAWN); 113 uninstallData.setState(WITHDRAWN);
113 break; 114 break;
114 } 115 }
115 - store.write(uninstallData); 116 + // Intent has been withdrawn; we can clear the installables
117 + store.write(new IntentData(uninstallData, Collections.emptyList()));
116 } 118 }
117 }; 119 };
118 120
......