Merge "Avoid NPexception on domainId mismatch"
diff --git a/global/http-channel/src/main/java/org/opencord/ce/global/channel/client/HttpClientInstance.java b/global/http-channel/src/main/java/org/opencord/ce/global/channel/client/HttpClientInstance.java
index eb820fb..5190363 100644
--- a/global/http-channel/src/main/java/org/opencord/ce/global/channel/client/HttpClientInstance.java
+++ b/global/http-channel/src/main/java/org/opencord/ce/global/channel/client/HttpClientInstance.java
@@ -112,7 +112,7 @@
}
private boolean isLeader(String topic) {
- return leadershipService.getLeader(topic).id()
+ return topic != null && leadershipService.getLeader(topic).id()
.equals(clusterService.getLocalNode().id().id());
}
@@ -135,7 +135,11 @@
}
private String getTopic(DomainId domainId) {
- return domainsEndPointsMap.get(domainId).getRight().topic();
+ if (domainsEndPointsMap.get(domainId) != null) {
+ return domainsEndPointsMap.get(domainId).getRight().topic();
+ }
+ log.info("Domain ID {} not among configured domain IDs", domainId.id());
+ return null;
}
private Client createClient() {