Removed bwc for GetIndexRequest serialisation

This commit is contained in:
Colin Goodheart-Smithe 2014-11-13 14:20:29 +00:00
parent 9e2f6bb5e5
commit f56976c2b3
1 changed files with 7 additions and 20 deletions

View File

@ -22,7 +22,6 @@ package org.elasticsearch.action.admin.indices.get;
import com.google.common.collect.ObjectArrays; import com.google.common.collect.ObjectArrays;
import org.elasticsearch.ElasticsearchIllegalArgumentException; import org.elasticsearch.ElasticsearchIllegalArgumentException;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.master.info.ClusterInfoRequest; import org.elasticsearch.action.support.master.info.ClusterInfoRequest;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
@ -140,31 +139,19 @@ public class GetIndexRequest extends ClusterInfoRequest<GetIndexRequest> {
@Override @Override
public void readFrom(StreamInput in) throws IOException { public void readFrom(StreamInput in) throws IOException {
super.readFrom(in); super.readFrom(in);
if (in.getVersion().before(Version.V_1_4_1)) { int size = in.readVInt();
Feature.convertToFeatures(in.readStringArray()); features = new Feature[size];
} else { for (int i = 0; i < size; i++) {
int size = in.readVInt(); features[i] = Feature.fromId(in.readByte());
features = new Feature[size];
for (int i = 0; i < size; i++) {
features[i] = Feature.fromId(in.readByte());
}
} }
} }
@Override @Override
public void writeTo(StreamOutput out) throws IOException { public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out); super.writeTo(out);
if (out.getVersion().before(Version.V_1_4_1)) { out.writeVInt(features.length);
String[] featureNames = new String[features.length]; for (Feature feature : features) {
for (int i = 0; i< features.length; i++) { out.writeByte(feature.id);
featureNames[i] = features[i].preferredName();
}
out.writeStringArray(featureNames);
} else {
out.writeVInt(features.length);
for (Feature feature : features) {
out.writeByte(feature.id);
}
} }
} }