Add comment explaining bytes reference edge case

This commit is contained in:
Ryan Ernst 2016-06-30 08:47:55 -07:00
parent e079c83020
commit 04a4bcdca0
1 changed files with 1 additions and 1 deletions

View File

@ -394,7 +394,7 @@ public abstract class AbstractBytesReferenceTestCase extends ESTestCase {
public void testSliceArrayOffset() throws IOException {
int length = randomInt(PAGE_SIZE * randomIntBetween(2, 5));
BytesReference pbr = newBytesReference(length);
int sliceOffset = randomIntBetween(0, pbr.length() - 1);
int sliceOffset = randomIntBetween(0, pbr.length() - 1); // an offset to the end would be len 0
int sliceLength = randomIntBetween(pbr.length() - sliceOffset, pbr.length() - sliceOffset);
BytesReference slice = pbr.slice(sliceOffset, sliceLength);
if (slice.hasArray()) {