fixed ByteBuffer usage

This commit is contained in:
jan 2013-08-11 13:51:53 +02:00
parent d6992d96d6
commit 5084fc0642
2 changed files with 1 additions and 21 deletions

View File

@ -67,7 +67,7 @@ public class StringInputRowParser implements ByteBufferInputRowParser
private Map<String, Object> buildStringKeyMap(ByteBuffer input)
{
int payloadSize = input.limit();
int payloadSize = input.remaining();
if (chars == null || chars.remaining() < payloadSize)
{

View File

@ -1,20 +0,0 @@
package com.metamx.druid.indexer.data;
import junit.framework.Assert;
import org.junit.Test;
import java.nio.ByteBuffer;
public class StringInputRowParserTest {
@Test
public void testPayloadSize() {
ByteBuffer payload = ByteBuffer.allocate(10);
payload.position(2);
payload.limit(5);
payload.rewind();
Assert.assertEquals(5, payload.limit());
}
}