Use empty BytesRef if we read from <= 1.4.0

This commit is contained in:
Simon Willnauer 2014-08-21 22:08:30 +02:00
parent ffcc78ca04
commit 3b51342515
1 changed files with 5 additions and 3 deletions

View File

@ -53,11 +53,11 @@ public class StoreFileMetaData implements Streamable {
}
public StoreFileMetaData(String name, long length, String checksum) {
this(name, length, checksum, null, new BytesRef());
this(name, length, checksum, null, null);
}
public StoreFileMetaData(String name, long length, String checksum, Version writtenBy) {
this(name, length, checksum, writtenBy, new BytesRef());
this(name, length, checksum, writtenBy, null);
}
public StoreFileMetaData(String name, long length, String checksum, Version writtenBy, BytesRef hash) {
@ -65,7 +65,7 @@ public class StoreFileMetaData implements Streamable {
this.length = length;
this.checksum = checksum;
this.writtenBy = writtenBy;
this.hash = hash;
this.hash = hash == null ? new BytesRef() : hash;
}
@ -126,6 +126,8 @@ public class StoreFileMetaData implements Streamable {
}
if (in.getVersion().onOrAfter(org.elasticsearch.Version.V_1_4_0)) {
hash = in.readBytesRef();
} else {
hash = new BytesRef();
}
}