Skip to content

Commit

Permalink
fix NPE in weibocom#470
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnights committed Jan 11, 2018
1 parent 1aca375 commit 7db1047
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,13 @@ protected String discoverCommand(URL url) {
}

private ConcurrentHashMap<String, List<URL>> lookupServiceUpdate(String group) {
ConcurrentHashMap<String, List<URL>> groupUrls = new ConcurrentHashMap<String, List<URL>>();
Long lastConsulIndexId = lookupGroupServices.get(group) == null ? 0 : lookupGroupServices.get(group);
ConsulResponse<List<ConsulService>> response = lookupConsulService(group, lastConsulIndexId);
if (response != null) {
List<ConsulService> services = response.getValue();
if (services != null && !services.isEmpty()
&& response.getConsulIndex() > lastConsulIndexId) {
ConcurrentHashMap<String, List<URL>> groupUrls = new ConcurrentHashMap<String, List<URL>>();
for (ConsulService service : services) {
try {
URL url = ConsulUtils.buildUrl(service);
Expand All @@ -239,7 +239,7 @@ private ConcurrentHashMap<String, List<URL>> lookupServiceUpdate(String group) {
LoggerUtil.info(group + " no need update, lastIndex:" + lastConsulIndexId);
}
}
return null;
return groupUrls;
}

private String lookupCommandUpdate(String group) {
Expand Down

0 comments on commit 7db1047

Please sign in to comment.