Handle missing actions when parsing WatchStatus

Original commit: elastic/x-pack-elasticsearch@b868aa1a62
This commit is contained in:
Nik Everett 2015-10-09 12:27:01 -04:00
parent 2bde3de3f0
commit f18b66fdc4
1 changed files with 3 additions and 1 deletions

View File

@ -28,6 +28,7 @@ import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import static java.util.Collections.emptyMap;
import static java.util.Collections.unmodifiableMap; import static java.util.Collections.unmodifiableMap;
import static org.elasticsearch.watcher.support.WatcherDateTimeUtils.parseDate; import static org.elasticsearch.watcher.support.WatcherDateTimeUtils.parseDate;
import static org.elasticsearch.watcher.support.WatcherDateTimeUtils.readDate; import static org.elasticsearch.watcher.support.WatcherDateTimeUtils.readDate;
@ -326,8 +327,9 @@ public class WatchStatus implements ToXContent, Streamable {
if (state == null) { if (state == null) {
state = new State(true, WatcherXContentParser.clock(parser).nowUTC()); state = new State(true, WatcherXContentParser.clock(parser).nowUTC());
} }
actions = actions == null ? emptyMap() : unmodifiableMap(actions);
return new WatchStatus(-1, state, lastChecked, lastMetCondition, unmodifiableMap(actions)); return new WatchStatus(-1, state, lastChecked, lastMetCondition, actions);
} }
public static class State implements ToXContent { public static class State implements ToXContent {