Return-Path: Delivered-To: apmail-hadoop-hdfs-commits-archive@minotaur.apache.org Received: (qmail 48747 invoked from network); 28 Oct 2009 23:30:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 28 Oct 2009 23:30:56 -0000 Received: (qmail 63222 invoked by uid 500); 28 Oct 2009 23:30:56 -0000 Delivered-To: apmail-hadoop-hdfs-commits-archive@hadoop.apache.org Received: (qmail 63169 invoked by uid 500); 28 Oct 2009 23:30:55 -0000 Mailing-List: contact hdfs-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hdfs-dev@hadoop.apache.org Delivered-To: mailing list hdfs-commits@hadoop.apache.org Received: (qmail 63159 invoked by uid 99); 28 Oct 2009 23:30:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Oct 2009 23:30:55 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.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; Wed, 28 Oct 2009 23:30:53 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 7F48C23888DC; Wed, 28 Oct 2009 23:30:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r830793 - in /hadoop/hdfs/trunk: CHANGES.txt src/java/org/apache/hadoop/hdfs/DFSClient.java Date: Wed, 28 Oct 2009 23:30:32 -0000 To: hdfs-commits@hadoop.apache.org From: szetszwo@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20091028233032.7F48C23888DC@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: szetszwo Date: Wed Oct 28 23:30:32 2009 New Revision: 830793 URL: http://svn.apache.org/viewvc?rev=830793&view=rev Log: HDFS-691. Fix an overflow error in DFSClient.DFSInputStream.available(). Modified: hadoop/hdfs/trunk/CHANGES.txt hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DFSClient.java Modified: hadoop/hdfs/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=830793&r1=830792&r2=830793&view=diff ============================================================================== --- hadoop/hdfs/trunk/CHANGES.txt (original) +++ hadoop/hdfs/trunk/CHANGES.txt Wed Oct 28 23:30:32 2009 @@ -31,8 +31,6 @@ HDFS-726. Eclipse .classpath template has outdated jar files and is missing some new ones. (cos) - HDFS-735. TestReadWhileWriting has wrong line termination symbols (cos) - Release 0.21.0 - Unreleased INCOMPATIBLE CHANGES @@ -462,6 +460,11 @@ HDFS-625. Fix NullPointerException thrown from ListPathServlet. (suresh) + HDFS-735. TestReadWhileWriting has wrong line termination symbols (cos) + + HDFS-691. Fix an overflow error in DFSClient.DFSInputStream.available(). + (szetszwo) + Release 0.20.2 - Unreleased IMPROVEMENTS Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DFSClient.java URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DFSClient.java?rev=830793&r1=830792&r2=830793&view=diff ============================================================================== --- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DFSClient.java (original) +++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DFSClient.java Wed Oct 28 23:30:32 2009 @@ -2331,14 +2331,18 @@ return pos; } - /** + /** Return the size of the remaining available bytes + * if the size is less than or equal to {@link Integer#MAX_VALUE}, + * otherwise, return {@link Integer#MAX_VALUE}. */ @Override public synchronized int available() throws IOException { if (closed) { throw new IOException("Stream closed"); } - return (int) (getFileLength() - pos); + + final long remaining = getFileLength() - pos; + return remaining <= Integer.MAX_VALUE? (int)remaining: Integer.MAX_VALUE; } /**