ONOS-6937
Cluster metadata file is not read even after correcting invalid data
Change-Id: I92095be8c9fc7e52689d6022bd93f78539c059fc
diff --git a/core/net/src/main/java/org/onosproject/cluster/impl/ConfigFileBasedClusterMetadataProvider.java b/core/net/src/main/java/org/onosproject/cluster/impl/ConfigFileBasedClusterMetadataProvider.java
index 6d5abf1..2ec138f 100644
--- a/core/net/src/main/java/org/onosproject/cluster/impl/ConfigFileBasedClusterMetadataProvider.java
+++ b/core/net/src/main/java/org/onosproject/cluster/impl/ConfigFileBasedClusterMetadataProvider.java
@@ -316,11 +316,15 @@
private void watchUrl(String metadataUrl) {
// TODO: We are merely polling the url.
// This can be easily addressed for files. For http urls we need to move to a push style protocol.
- Versioned<ClusterMetadata> latestMetadata = fetchMetadata(metadataUrl);
- if (cachedMetadata.get() != null && latestMetadata != null
- && cachedMetadata.get().version() < latestMetadata.version()) {
- cachedMetadata.set(latestMetadata);
- providerService.clusterMetadataChanged(latestMetadata);
+ try {
+ Versioned<ClusterMetadata> latestMetadata = fetchMetadata(metadataUrl);
+ if (cachedMetadata.get() != null && latestMetadata != null
+ && cachedMetadata.get().version() < latestMetadata.version()) {
+ cachedMetadata.set(latestMetadata);
+ providerService.clusterMetadataChanged(latestMetadata);
+ }
+ } catch (Exception e) {
+ log.error("Unable to parse metadata : ", e);
}
}
}
\ No newline at end of file