fix approximate histogram serde to not change buffer limit

This commit is contained in:
Xavier Léauté 2014-07-01 16:13:00 -07:00
parent 70ae6e1fcd
commit d0b8494735
1 changed files with 3 additions and 2 deletions

View File

@ -110,8 +110,9 @@ public class ApproximateHistogramFoldingSerde extends ComplexMetricSerde
@Override
public ApproximateHistogram fromByteBuffer(ByteBuffer buffer, int numBytes)
{
buffer.limit(buffer.position() + numBytes);
return ApproximateHistogram.fromBytes(buffer);
final ByteBuffer readOnlyBuffer = buffer.asReadOnlyBuffer();
readOnlyBuffer.limit(readOnlyBuffer.position() + numBytes);
return ApproximateHistogram.fromBytes(readOnlyBuffer);
}
@Override