Fix serialization of short[] arays.

short[] were mistakenly encoded as a float[]. This is not an issue for the
text-based xcontents that we have (yaml, json) since floats can represent any
short value and are serialized as strings. However, this will make the binary
xcontents serialize shorts as int instead of floats.

Close #7845
This commit is contained in:
Adrien Grand 2014-10-08 17:29:11 +02:00
parent 4ee91cb331
commit ede60df804

View File

@ -1272,7 +1272,7 @@ public final class XContentBuilder implements BytesStream, Releasable {
generator.writeEndArray();
} else if (value instanceof short[]) {
generator.writeStartArray();
for (float v : (short[]) value) {
for (short v : (short[]) value) {
generator.writeNumber(v);
}
generator.writeEndArray();