Skip to content

Commit

Permalink
Update version checks in ElasticsearchException serialization methods
Browse files Browse the repository at this point in the history
  • Loading branch information
javanna committed Jan 24, 2017
1 parent 3002757 commit dc3834f
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ public ElasticsearchException(StreamInput in) throws IOException {
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(); ) {
Expand Down Expand Up @@ -283,8 +282,7 @@ public void writeTo(StreamOutput out) throws IOException {
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 {
Expand Down

0 comments on commit dc3834f

Please sign in to comment.