Skip to content

Commit 5103b76

Browse files
committed
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.
1 parent 304296e commit 5103b76

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)