Guards against NPE.

see gh-789
This commit is contained in:
Spencer Gibb
2019-02-05 22:00:55 -05:00
parent 7019231127
commit b25e6b15e9

View File

@@ -184,7 +184,16 @@ public class WeightCalculatorWebFilter implements WebFilter, Ordered, SmartAppli
public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
Map<String, String> weights = getWeights(exchange);
groupWeights.forEach((group, config) -> {
for (String group : groupWeights.keySet()) {
GroupWeightConfig config = groupWeights.get(group);
if (config == null) {
if (log.isDebugEnabled()) {
log.debug("No GroupWeightConfig found for group: " + group);
}
continue; // nothing we can do, but this is odd
}
double r = this.random.nextDouble();
List<Double> ranges = config.ranges;
@@ -200,7 +209,7 @@ public class WeightCalculatorWebFilter implements WebFilter, Ordered, SmartAppli
break;
}
}
});
}
if (log.isTraceEnabled()) {
log.trace("Weights attr: "+weights);