rawlinp commented on a change in pull request #5133:
URL: https://github.com/apache/trafficcontrol/pull/5133#discussion_r503485675
##########
File path:
traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/edge/Node.java
##########
@@ -200,9 +200,18 @@ public InetAddress getIp6() {
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.NPathComplexity"})
public void setState(final JsonNode state) {
- final boolean isAvailable = JsonUtils.optBoolean(state,
"isAvailable", true);
- final boolean ipv4Available = JsonUtils.optBoolean(state,
"ipv4Available", true);
- final boolean ipv6Available = JsonUtils.optBoolean(state,
"ipv6Available", true);
+ final boolean ipv4Available;
+ final boolean ipv6Available;
+ if (state == null) {
+ LOGGER.warn("got null health state for " + fqdn + ".
Setting it to unavailable!");
+ isAvailable = false;
+ ipv4Available = false;
+ ipv6Available = false;
+ } else {
+ isAvailable = JsonUtils.optBoolean(state,
"isAvailable", true);
+ ipv4Available = JsonUtils.optBoolean(state,
"ipv4Available", true);
+ ipv6Available = JsonUtils.optBoolean(state,
"ipv6Available", true);
+ }
Review comment:
Yep, that is correct.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]