cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject svn commit: r1089139 - /cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/util/MappedFileDataInput.java
Date Tue, 05 Apr 2011 17:27:01 GMT
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);



Mime
View raw message