Skip to content

Commit

Permalink
Change version condition after backport
Browse files Browse the repository at this point in the history
Change AnalyzeAction response serialization version condition after #44284 has
been backported
  • Loading branch information
Christoph Büscher committed Jul 14, 2019
1 parent 36d11e8 commit 797628e
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ public Response(List<AnalyzeToken> tokens, DetailAnalyzeResponse detail) {

public Response(StreamInput in) throws IOException {
super.readFrom(in);
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
if (in.getVersion().onOrAfter(Version.V_7_3_0)) {
AnalyzeToken[] tokenArray = in.readOptionalArray(AnalyzeToken::new, AnalyzeToken[]::new);
tokens = tokenArray != null ? Arrays.asList(tokenArray) : null;
} else {
Expand Down Expand Up @@ -354,7 +354,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws

@Override
public void writeTo(StreamOutput out) throws IOException {
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
if (out.getVersion().onOrAfter(Version.V_7_3_0)) {
AnalyzeToken[] tokenArray = null;
if (tokens != null) {
tokenArray = tokens.toArray(new AnalyzeToken[0]);
Expand Down Expand Up @@ -722,7 +722,7 @@ public AnalyzeTokenList(String name, AnalyzeToken[] tokens) {

AnalyzeTokenList(StreamInput in) throws IOException {
name = in.readString();
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
if (in.getVersion().onOrAfter(Version.V_7_3_0)) {
tokens = in.readOptionalArray(AnalyzeToken::new, AnalyzeToken[]::new);
} else {
int size = in.readVInt();
Expand Down Expand Up @@ -767,7 +767,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeString(name);
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
if (out.getVersion().onOrAfter(Version.V_7_3_0)) {
out.writeOptionalArray(tokens);
} else {
if (tokens != null) {
Expand Down

0 comments on commit 797628e

Please sign in to comment.