瀏覽代碼

Call superclass constructor in XPackInfoRequest (#67402)

* Call superclass constructor in XPackInfoRequest

The XPackInfoRequest class didn't use the normal Writeable pattern of
calling its superclass's constructor and writeTo methods when
deserializing and serializing from StreamInput and StreamOutput. We had
worked around this by manually doing what those methods would do in a
backwards compatible way. Here, we will update our master branch to use
the correct pattern in 8.x and beyond.
William Brafford 4 年之前
父節點
當前提交
76d7de8f59
共有 1 個文件被更改,包括 2 次插入11 次删除
  1. 2 11
      x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/XPackInfoRequest.java

+ 2 - 11
x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/XPackInfoRequest.java

@@ -11,7 +11,6 @@ import org.elasticsearch.action.ActionRequestValidationException;
 import org.elasticsearch.common.io.stream.StreamInput;
 import org.elasticsearch.common.io.stream.StreamOutput;
 import org.elasticsearch.license.License;
-import org.elasticsearch.tasks.TaskId;
 
 import java.io.IOException;
 import java.util.EnumSet;
@@ -48,12 +47,7 @@ public class XPackInfoRequest extends ActionRequest {
     }
 
     public XPackInfoRequest(StreamInput in) throws IOException {
-        // NOTE: this does *not* call super, THIS IS A BUG that will be fixed in 8.x
-        if (in.getVersion().onOrAfter(Version.V_7_12_0)) {
-            // The superclass constructor would set the parent task ID, but for now
-            // we must serialize and deserialize manually.
-            setParentTask(TaskId.readFromStream(in));
-        }
+        super(in);
         this.verbose = in.readBoolean();
         EnumSet<Category> categories = EnumSet.noneOf(Category.class);
         int size = in.readVInt();
@@ -89,10 +83,7 @@ public class XPackInfoRequest extends ActionRequest {
 
     @Override
     public void writeTo(StreamOutput out) throws IOException {
-        // NOTE: this does *not* call super.writeTo(out), THIS IS A BUG that will be fixed in 8.x
-        if (out.getVersion().onOrAfter(Version.V_7_12_0)) {
-            getParentTask().writeTo(out);
-        }
+        super.writeTo(out);
         out.writeBoolean(verbose);
         out.writeVInt(categories.size());
         for (Category category : categories) {