Skip to content

Commit dc3834f

Browse files
committed
Update version checks in ElasticsearchException serialization methods
1 parent 3002757 commit dc3834f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

core/src/main/java/org/elasticsearch/ElasticsearchException.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ public ElasticsearchException(StreamInput in) throws IOException {
131131
super(in.readOptionalString(), in.readException());
132132
readStackTrace(this, in);
133133
headers.putAll(in.readMapOfLists(StreamInput::readString, StreamInput::readString));
134-
//TODO change to onOrAfter once backported to 5.x
135-
if (in.getVersion().after(Version.V_5_3_0_UNRELEASED)) {
134+
if (in.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
136135
metadata.putAll(in.readMapOfLists(StreamInput::readString, StreamInput::readString));
137136
} else {
138137
for (Iterator<Map.Entry<String, List<String>>> iterator = headers.entrySet().iterator(); iterator.hasNext(); ) {
@@ -283,8 +282,7 @@ public void writeTo(StreamOutput out) throws IOException {
283282
out.writeOptionalString(this.getMessage());
284283
out.writeException(this.getCause());
285284
writeStackTraces(this, out);
286-
//TODO change to onOrAfter once backported to 5.x
287-
if (out.getVersion().after(Version.V_5_3_0_UNRELEASED)) {
285+
if (out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
288286
out.writeMapOfLists(headers, StreamOutput::writeString, StreamOutput::writeString);
289287
out.writeMapOfLists(metadata, StreamOutput::writeString, StreamOutput::writeString);
290288
} else {

0 commit comments

Comments
 (0)