You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sl...@apache.org on 2011/04/05 19:27:01 UTC
svn commit: r1089139 -
/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/util/MappedFileDataInput.java
Author: slebresne
Date: Tue Apr 5 17:27:01 2011
New Revision: 1089139
URL: http://svn.apache.org/viewvc?rev=1089139&view=rev
Log:
Convert mmap assertion to if/throw
patch by jbellis; reviewed by slebresne for CASSANDRA-2417
Modified:
cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/util/MappedFileDataInput.java
Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/util/MappedFileDataInput.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/util/MappedFileDataInput.java?rev=1089139&r1=1089138&r2=1089139&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/util/MappedFileDataInput.java (original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/util/MappedFileDataInput.java Tue Apr 5 17:27:01 2011
@@ -114,9 +114,9 @@ public class MappedFileDataInput extends
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);