Skip to content

Commit

Permalink
Fix BWC assertion in GetFieldMappingsResponse (elastic#49706)
Browse files Browse the repository at this point in the history
  • Loading branch information
romseygeek authored and SivagurunathanV committed Jan 21, 2020
1 parent 2a4860d commit b7bac25
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

import java.io.IOException;
import java.io.InputStream;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
Expand Down Expand Up @@ -66,7 +67,11 @@ public class GetFieldMappingsResponse extends ActionResponse implements ToXConte
String index = in.readString();
if (in.getVersion().before(Version.V_8_0_0)) {
int typesSize = in.readVInt();
assert typesSize == 1;
assert typesSize == 1 || typesSize == 0 : "Expected 0 or 1 types but got " + typesSize;
if (typesSize == 0) {
indexMapBuilder.put(index, Collections.emptyMap());
continue;
}
in.readString(); // type
}
int fieldSize = in.readVInt();
Expand Down

0 comments on commit b7bac25

Please sign in to comment.