diff --git a/plugin/src/main/java/org/elasticsearch/xpack/ml/action/UpdateProcessAction.java b/plugin/src/main/java/org/elasticsearch/xpack/ml/action/UpdateProcessAction.java index 7c480f10799..508d5193188 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/ml/action/UpdateProcessAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/ml/action/UpdateProcessAction.java @@ -142,7 +142,7 @@ public class UpdateProcessAction extends super.readFrom(in); modelPlotConfig = in.readOptionalWriteable(ModelPlotConfig::new); if (in.readBoolean()) { - in.readList(JobUpdate.DetectorUpdate::new); + detectorUpdates = in.readList(JobUpdate.DetectorUpdate::new); } } diff --git a/plugin/src/test/java/org/elasticsearch/xpack/ml/action/UpdateProcessActionRequestTests.java b/plugin/src/test/java/org/elasticsearch/xpack/ml/action/UpdateProcessActionRequestTests.java index 984485a317f..60ddb1495d4 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/ml/action/UpdateProcessActionRequestTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/ml/action/UpdateProcessActionRequestTests.java @@ -9,6 +9,7 @@ import org.elasticsearch.test.AbstractStreamableTestCase; import org.elasticsearch.xpack.ml.job.config.JobUpdate; import org.elasticsearch.xpack.ml.job.config.ModelPlotConfig; +import java.util.ArrayList; import java.util.List; public class UpdateProcessActionRequestTests extends AbstractStreamableTestCase { @@ -22,9 +23,10 @@ public class UpdateProcessActionRequestTests extends AbstractStreamableTestCase< } List updates = null; if (randomBoolean()) { + updates = new ArrayList<>(); int detectorUpdateCount = randomIntBetween(0, 5); for (int i = 0; i < detectorUpdateCount; i++) { - new JobUpdate.DetectorUpdate(randomInt(), randomAlphaOfLength(10), null); + updates.add(new JobUpdate.DetectorUpdate(randomInt(), randomAlphaOfLength(10), null)); } } return new UpdateProcessAction.Request(randomAlphaOfLength(10), config, updates);