@@ -122,7 +122,7 @@ public class ShardFollowTask implements XPackPlugin.XPackPersistentTaskParams {
122
122
}
123
123
124
124
public ShardFollowTask (StreamInput in ) throws IOException {
125
- this .leaderCluster = in .readOptionalString ();
125
+ this .leaderCluster = in .readString ();
126
126
this .followShardId = ShardId .readShardId (in );
127
127
this .leaderShardId = ShardId .readShardId (in );
128
128
this .maxBatchOperationCount = in .readVInt ();
@@ -190,7 +190,7 @@ public String getWriteableName() {
190
190
191
191
@ Override
192
192
public void writeTo (StreamOutput out ) throws IOException {
193
- out .writeOptionalString (leaderCluster );
193
+ out .writeString (leaderCluster );
194
194
followShardId .writeTo (out );
195
195
leaderShardId .writeTo (out );
196
196
out .writeVLong (maxBatchOperationCount );
@@ -210,9 +210,7 @@ public static ShardFollowTask fromXContent(XContentParser parser) {
210
210
@ Override
211
211
public XContentBuilder toXContent (XContentBuilder builder , Params params ) throws IOException {
212
212
builder .startObject ();
213
- if (leaderCluster != null ) {
214
- builder .field (LEADER_CLUSTER_FIELD .getPreferredName (), leaderCluster );
215
- }
213
+ builder .field (LEADER_CLUSTER_FIELD .getPreferredName (), leaderCluster );
216
214
builder .field (FOLLOW_SHARD_INDEX_FIELD .getPreferredName (), followShardId .getIndex ().getName ());
217
215
builder .field (FOLLOW_SHARD_INDEX_UUID_FIELD .getPreferredName (), followShardId .getIndex ().getUUID ());
218
216
builder .field (FOLLOW_SHARD_SHARDID_FIELD .getPreferredName (), followShardId .id ());
0 commit comments