[SDFAB-612] Cluster not ready when using recent tost master images
There is no guarantee that the HostProbingProvider is already
registered before setDelegate is called. This patch prevents
npe caused by events delivered before the provider is ready
Change-Id: I8612a3b156e342752d1ade9ee1d7d786ad53cc9e
(cherry picked from commit e84b2e8081ea40ff06eaa1b119c6e22cfcf9459d)
diff --git a/core/net/src/main/java/org/onosproject/net/host/impl/HostProbingManager.java b/core/net/src/main/java/org/onosproject/net/host/impl/HostProbingManager.java
index ea3a8a1..64f2791 100644
--- a/core/net/src/main/java/org/onosproject/net/host/impl/HostProbingManager.java
+++ b/core/net/src/main/java/org/onosproject/net/host/impl/HostProbingManager.java
@@ -52,7 +52,12 @@
private static final String SCHEME = "hostprobing";
private HostProbingStoreDelegate delegate = event -> {
- getProvider(SCHEME).processEvent(event);
+ HostProbingProvider hostProbingProvider = getProvider(SCHEME);
+ if (hostProbingProvider != null) {
+ hostProbingProvider.processEvent(event);
+ } else {
+ log.warn("Unable to find host probing provider. Cannot handle event {}", event);
+ }
};
@Activate