use offset when detecting xcontent type

This commit is contained in:
kimchy 2010-05-11 22:38:00 +03:00
parent 9c042a2b25
commit 7c53ef1084
1 changed files with 1 additions and 1 deletions

View File

@ -156,7 +156,7 @@ public class XContentFactory {
*/
public static XContentType xContentType(byte[] data, int offset, int length) {
length = length < GUESS_HEADER_LENGTH ? length : GUESS_HEADER_LENGTH;
if (length > 1 && data[0] == 0x00 && data[1] == 0x00) {
if (length > 1 && data[offset] == 0x00 && data[offset + 1] == 0x00) {
return XContentType.XSON;
}
for (int i = offset; i < length; i++) {