Return-Path: Delivered-To: apmail-hadoop-core-dev-archive@www.apache.org Received: (qmail 20808 invoked from network); 30 May 2008 17:09:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 May 2008 17:09:07 -0000 Received: (qmail 14287 invoked by uid 500); 30 May 2008 17:09:08 -0000 Delivered-To: apmail-hadoop-core-dev-archive@hadoop.apache.org Received: (qmail 14260 invoked by uid 500); 30 May 2008 17:09:08 -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 14243 invoked by uid 99); 30 May 2008 17:09:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 May 2008 10:09:08 -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; Fri, 30 May 2008 17:08:28 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 63597234C12E for ; Fri, 30 May 2008 10:08:45 -0700 (PDT) Message-ID: <73609462.1212167325405.JavaMail.jira@brutus> Date: Fri, 30 May 2008 10:08:45 -0700 (PDT) From: "Chad Whipkey (JIRA)" To: core-dev@hadoop.apache.org Subject: [jira] Updated: (HADOOP-3454) Text.find incorrectly searches beyond the end of the buffer In-Reply-To: <13631833.1211927819726.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-3454?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Chad Whipkey updated HADOOP-3454: --------------------------------- Attachment: HADOOP-3454.patch > Text.find incorrectly searches beyond the end of the buffer > ----------------------------------------------------------- > > Key: HADOOP-3454 > URL: https://issues.apache.org/jira/browse/HADOOP-3454 > Project: Hadoop Core > Issue Type: Bug > Affects Versions: 0.17.0 > Reporter: Chad Whipkey > Attachments: HADOOP-3454.patch > > > Text.find() does not pay attention to the length field. So, this code: > {code} > public void testTextFind() > { > Text t = new Text("FIND AN I"); > t.set(new byte[] { (byte) 'F' }); > assert t.getLength() == 1 : "Length should be 1"; > assert t.find( "F") == 0 : "Found F at " + t.find("F"); > assert t.find( "I") == -1 : "Found I at " + t.find("I"); > } > {code} > incorrectly throws an assertion because it finds the I at position 1, even though the Text is only one byte long. > I think to fix this it is enough to change this line in Text.find: > ByteBuffer src = ByteBuffer.wrap(this.bytes); > to > ByteBuffer src = ByteBuffer.wrap(this.bytes,0,this.length); -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.