Merge CASSANDRA-2417 from 0.7

git-svn-id: https://svn.apache.org/repos/asf/cassandra/trunk@1089140 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sylvain Lebresne 2011-04-05 17:28:43 +00:00
parent a234853e5a
commit a25f730005
1 changed files with 3 additions and 3 deletions

View File

@ -113,9 +113,9 @@ public class MappedFileDataInput extends AbstractDataInput implements FileDataIn
public synchronized ByteBuffer readBytes(int length) throws IOException
{
int remaining = buffer.remaining() - position;
assert length <= remaining
: String.format("mmap segment underflow; remaining is %d but %d requested", remaining, length);
if (length > remaining)
throw new IOException(String.format("mmap segment underflow; remaining is %d but %d requested",
remaining, length));
ByteBuffer bytes = buffer.duplicate();
bytes.position(buffer.position() + position).limit(buffer.position() + position + length);