Prevent NPE parsing the stop datafeed request. (#33347)

The issue depends on the request parameters being passed in the request
body rather than as query parameters.
This commit is contained in:
David Kyle 2018-09-03 13:35:04 +01:00 committed by GitHub
parent 54fe7fb5a1
commit ccb2ad25cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -73,14 +73,13 @@ public class StopDatafeedAction extends Action<StopDatafeedAction.Response> {
}
private String datafeedId;
private String[] resolvedStartedDatafeedIds;
private String[] resolvedStartedDatafeedIds = new String[] {};
private TimeValue stopTimeout = DEFAULT_TIMEOUT;
private boolean force = false;
private boolean allowNoDatafeeds = true;
public Request(String datafeedId) {
this.datafeedId = ExceptionsHelper.requireNonNull(datafeedId, DatafeedConfig.ID.getPreferredName());
this.resolvedStartedDatafeedIds = new String[] { datafeedId };
}
public Request() {

View File

@ -24,6 +24,9 @@ public class StopDatafeedActionRequestTests extends AbstractStreamableXContentTe
if (randomBoolean()) {
request.setAllowNoDatafeeds(randomBoolean());
}
if (randomBoolean()) {
request.setResolvedStartedDatafeedIds(generateRandomStringArray(4, 8, false));
}
return request;
}