cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1074216 - /cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/util/BufferedRandomAccessFile.java
Date Thu, 24 Feb 2011 17:04:45 GMT
Author: jbellis
Date: Thu Feb 24 17:04:45 2011
New Revision: 1074216

URL: http://svn.apache.org/viewvc?rev=1074216&view=rev
Log:
avoid non-positive BufferSize.  this + previous exposes a bug in EOF handling

Modified:
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/util/BufferedRandomAccessFile.java

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/util/BufferedRandomAccessFile.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/util/BufferedRandomAccessFile.java?rev=1074216&r1=1074215&r2=1074216&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/util/BufferedRandomAccessFile.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/util/BufferedRandomAccessFile.java
Thu Feb 24 17:04:45 2011
@@ -83,7 +83,7 @@ public class BufferedRandomAccessFile ex
      */
     public BufferedRandomAccessFile(String name, String mode) throws IOException
     {
-        this(new File(name), mode, 0);
+        this(new File(name), mode, DEFAULT_BUFFER_SIZE);
     }
 
     public BufferedRandomAccessFile(String name, String mode, int bufferSize) throws IOException
@@ -98,7 +98,7 @@ public class BufferedRandomAccessFile ex
      */
     public BufferedRandomAccessFile(File file, String mode) throws IOException
     {
-        this(file, mode, 0);
+        this(file, mode, DEFAULT_BUFFER_SIZE);
     }
 
     public BufferedRandomAccessFile(File file, String mode, int bufferSize) throws IOException
@@ -116,6 +116,8 @@ public class BufferedRandomAccessFile ex
         filePath = file.getAbsolutePath();
 
         // allocating required size of the buffer
+        if (bufferSize <= 0)
+            throw new IllegalArgumentException("bufferSize must be positive");
         buffer = ByteBuffer.allocate(bufferSize);
 
         // if in read-only mode, caching file size



Mime
View raw message