Return-Path: Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: (qmail 29320 invoked from network); 24 Feb 2011 17:05:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Feb 2011 17:05:11 -0000 Received: (qmail 70713 invoked by uid 500); 24 Feb 2011 17:05:10 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 70579 invoked by uid 500); 24 Feb 2011 17:05:09 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 70571 invoked by uid 99); 24 Feb 2011 17:05:08 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Feb 2011 17:05:08 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Feb 2011 17:05:06 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 677FA238896F; Thu, 24 Feb 2011 17:04:45 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@cassandra.apache.org From: jbellis@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110224170445.677FA238896F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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