bug fix: create empty response in post data action for serialization

added getter for data counts
and initialize resetStart / resetEnd with empty strings

Original commit: elastic/x-pack-elasticsearch@d4925506e6
This commit is contained in:
Martijn van Groningen 2016-11-22 10:40:23 +01:00
parent 15c9e8baa4
commit 5214de23a1
1 changed files with 10 additions and 3 deletions

View File

@ -53,7 +53,7 @@ public class PostDataAction extends Action<PostDataAction.Request, PostDataActio
@Override @Override
public Response newResponse() { public Response newResponse() {
return null; return new Response();
} }
static class RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder> { static class RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder> {
@ -71,10 +71,17 @@ public class PostDataAction extends Action<PostDataAction.Request, PostDataActio
dataCounts = new DataCounts(jobId); dataCounts = new DataCounts(jobId);
} }
private Response() {
}
public Response(DataCounts counts) { public Response(DataCounts counts) {
this.dataCounts = counts; this.dataCounts = counts;
} }
public DataCounts getDataCounts() {
return dataCounts;
}
@Override @Override
public void readFrom(StreamInput in) throws IOException { public void readFrom(StreamInput in) throws IOException {
super.readFrom(in); super.readFrom(in);
@ -125,8 +132,8 @@ public class PostDataAction extends Action<PostDataAction.Request, PostDataActio
private String jobId; private String jobId;
private boolean ignoreDowntime = false; private boolean ignoreDowntime = false;
private String resetStart; private String resetStart = "";
private String resetEnd; private String resetEnd = "";
private BytesReference content; private BytesReference content;
Request() { Request() {