Skip to content

Commit

Permalink
Defensive check to solve issue apache#3923 (apache#3931)
Browse files Browse the repository at this point in the history
  • Loading branch information
beiwei30 authored and vio-lin committed Apr 29, 2019
1 parent 9d5110d commit e5b7414
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ExecutorService;
Expand Down Expand Up @@ -200,7 +201,11 @@ private boolean isProviderSide(URL url) {

private List<URL> convert(List<HealthService> services) {
return services.stream()
.map(s -> s.getService().getMeta().get(URL_META_KEY))
.map(HealthService::getService)
.filter(Objects::nonNull)
.map(HealthService.Service::getMeta)
.filter(m -> m != null && m.containsKey(URL_META_KEY))
.map(m -> m.get(URL_META_KEY))
.map(URL::valueOf)
.collect(Collectors.toList());
}
Expand Down

0 comments on commit e5b7414

Please sign in to comment.