Return-Path: Delivered-To: apmail-hadoop-core-dev-archive@www.apache.org Received: (qmail 72391 invoked from network); 25 Jun 2008 09:35:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 Jun 2008 09:35:10 -0000 Received: (qmail 53532 invoked by uid 500); 25 Jun 2008 09:35:07 -0000 Delivered-To: apmail-hadoop-core-dev-archive@hadoop.apache.org Received: (qmail 53477 invoked by uid 500); 25 Jun 2008 09:35:07 -0000 Mailing-List: contact core-dev-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: core-dev@hadoop.apache.org Delivered-To: mailing list core-dev@hadoop.apache.org Received: (qmail 53453 invoked by uid 99); 25 Jun 2008 09:35:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Jun 2008 02:35:07 -0700 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.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Jun 2008 09:34:25 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id F3E9B234C147 for ; Wed, 25 Jun 2008 02:34:44 -0700 (PDT) Message-ID: <247662288.1214386484984.JavaMail.jira@brutus> Date: Wed, 25 Jun 2008 02:34:44 -0700 (PDT) From: "Tom White (JIRA)" To: core-dev@hadoop.apache.org Subject: [jira] Updated: (HADOOP-3640) NativeS3FsInputStream read() method for reading a single byte is incorrect In-Reply-To: <1394834049.1214385885300.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HADOOP-3640?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tom White updated HADOOP-3640: ------------------------------ Attachment: hadoop-3640.patch Patch to make this change. Interestingly, this is not causing a problem since the NativeS3FsInputStream (which is a private class) is always wrapped in BufferedFSInputStream. BufferedFSInputStream actually never calls read() (the single byte version) on the underlying stream, even from its implementation of read(), since it uses the buffered version. > NativeS3FsInputStream read() method for reading a single byte is incorrect > -------------------------------------------------------------------------- > > Key: HADOOP-3640 > URL: https://issues.apache.org/jira/browse/HADOOP-3640 > Project: Hadoop Core > Issue Type: Bug > Affects Versions: 0.18.0 > Reporter: Tom White > Assignee: Tom White > Attachments: hadoop-3640.patch > > > From Albert Chern: > I think there may be a bug in the read() method of NativeS3InputStream, which looks like this: > {code} > public synchronized int read() throws IOException { > int result = in.read(); > if (result > 0) { > pos += result; > } > return result; > } > {code} > The return value of InputStream.read() should be the next byte in the range 0 to 255, or -1 if there are no more bytes. So shouldn't this method look something like this? > {code} > public synchronized int read() throws IOException { > int result = in.read(); > if (result > -1) { > pos ++; > } > return result; > } > {code} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.