[FLINK-7808] [REST] JobDetails constructor checks size of tasksPerState argument
This closes #4800. Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/e2ae45b4 Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/e2ae45b4 Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/e2ae45b4 Branch: refs/heads/master Commit: e2ae45b48345cf56501530e101f3c8523448ab79 Parents: 891f359 Author: zentol <[email protected]> Authored: Wed Oct 11 13:47:38 2017 +0200 Committer: zentol <[email protected]> Committed: Wed Oct 11 22:06:58 2017 +0200 ---------------------------------------------------------------------- .../org/apache/flink/runtime/messages/webmonitor/JobDetails.java | 3 +++ 1 file changed, 3 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flink/blob/e2ae45b4/flink-runtime/src/main/java/org/apache/flink/runtime/messages/webmonitor/JobDetails.java ---------------------------------------------------------------------- diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/messages/webmonitor/JobDetails.java b/flink-runtime/src/main/java/org/apache/flink/runtime/messages/webmonitor/JobDetails.java index 2aca75b..16dfa51 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/messages/webmonitor/JobDetails.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/messages/webmonitor/JobDetails.java @@ -21,6 +21,7 @@ package org.apache.flink.runtime.messages.webmonitor; import org.apache.flink.api.common.JobID; import org.apache.flink.runtime.execution.ExecutionState; import org.apache.flink.runtime.jobgraph.JobStatus; +import org.apache.flink.util.Preconditions; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParser; @@ -92,6 +93,8 @@ public class JobDetails implements Serializable { this.duration = duration; this.status = checkNotNull(status); this.lastUpdateTime = lastUpdateTime; + Preconditions.checkArgument(tasksPerState.length == ExecutionState.values().length, + "tasksPerState argument must be of size {}.", ExecutionState.values().length); this.tasksPerState = checkNotNull(tasksPerState); this.numTasks = numTasks; }
