mirror of https://github.com/apache/cassandra
Convert mmap assertion to if/throw
patch by jbellis; reviewed by slebresne for CASSANDRA-2417 git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-0.7@1089139 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ee1bb5aa95
commit
bdba69ff8d
|
|
@ -114,9 +114,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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue