Recover from NPE that can sometimes be thrown by Felix
Change-Id: Ib9415df4708dc1265edfdaf4168bd29eb0805614
diff --git a/core/net/src/main/java/org/onosproject/cluster/impl/ComponentsMonitor.java b/core/net/src/main/java/org/onosproject/cluster/impl/ComponentsMonitor.java
index c72c0c7..3c81649 100644
--- a/core/net/src/main/java/org/onosproject/cluster/impl/ComponentsMonitor.java
+++ b/core/net/src/main/java/org/onosproject/cluster/impl/ComponentsMonitor.java
@@ -94,9 +94,16 @@
}
private boolean isFullyStarted(Feature feature) {
- return feature.getBundles().stream()
- .map(info -> bundleContext.getBundle(info.getLocation()))
- .allMatch(this::isFullyStarted);
+ try {
+ return feature.getBundles().stream()
+ .map(info -> bundleContext.getBundle(info.getLocation()))
+ .allMatch(this::isFullyStarted);
+ } catch (NullPointerException npe) {
+ // FIXME: Remove this catch block when Felix fixes the bug
+ // Due to a bug in the Felix implementation, this can throw an NPE.
+ // Catch the error and do something sensible with it.
+ return false;
+ }
}
private boolean isFullyStarted(Bundle bundle) {