update version checks in ElasticsearchException serialization code

5.3.0 is the first version that contains the split from headers to metadata, updated the check to reflect that. It was previously after to be able to commit to master first, and only after that backport the change. Otherwise master tests would have failed until the change was backported.
This commit is contained in:
javanna 2017-01-24 20:39:54 +01:00 committed by Luca Cavanna
parent 304296ea6a
commit 5103b76610
1 changed files with 2 additions and 4 deletions

View File

@ -131,8 +131,7 @@ public class ElasticsearchException extends RuntimeException implements ToXConte
super(in.readOptionalString(), in.readException());
readStackTrace(this, in);
headers.putAll(in.readMapOfLists(StreamInput::readString, StreamInput::readString));
//TODO change to onOrAfter once backported to 5.x
if (in.getVersion().after(Version.V_5_3_0_UNRELEASED)) {
if (in.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
metadata.putAll(in.readMapOfLists(StreamInput::readString, StreamInput::readString));
} else {
for (Iterator<Map.Entry<String, List<String>>> iterator = headers.entrySet().iterator(); iterator.hasNext(); ) {
@ -283,8 +282,7 @@ public class ElasticsearchException extends RuntimeException implements ToXConte
out.writeOptionalString(this.getMessage());
out.writeException(this.getCause());
writeStackTraces(this, out);
//TODO change to onOrAfter once backported to 5.x
if (out.getVersion().after(Version.V_5_3_0_UNRELEASED)) {
if (out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
out.writeMapOfLists(headers, StreamOutput::writeString, StreamOutput::writeString);
out.writeMapOfLists(metadata, StreamOutput::writeString, StreamOutput::writeString);
} else {