Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 63110 invoked from network); 7 Apr 2009 03:41:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Apr 2009 03:41:37 -0000 Received: (qmail 79393 invoked by uid 500); 7 Apr 2009 03:41:37 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 79332 invoked by uid 500); 7 Apr 2009 03:41:36 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 79323 invoked by uid 99); 7 Apr 2009 03:41:36 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Apr 2009 03:41:36 +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.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Apr 2009 03:41:34 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 4959F234C004 for ; Mon, 6 Apr 2009 20:41:13 -0700 (PDT) Message-ID: <1876629435.1239075673284.JavaMail.jira@brutus> Date: Mon, 6 Apr 2009 20:41:13 -0700 (PDT) From: "Kevin Zhou (JIRA)" To: commits@harmony.apache.org Subject: [jira] Commented: (HARMONY-6139) [classlib][luni] java.util.Arrays.binarySearch(short[] array, int startIndex, int endIndex, short value) should return (-(insertion point) - 1) rather than -1 if value is not found in the given range In-Reply-To: <2099192039.1239074473031.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HARMONY-6139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12696386#action_12696386 ] Kevin Zhou commented on HARMONY-6139: ------------------------------------- This also happens to the other binarySearch methods of java.util.Arrays class. For instance, binarySearch(byte[] a, int fromIndex, int toIndex, byte key) binarySearch(char[] a, int fromIndex, int toIndex, char key) binarySearch(double[] a, int fromIndex, int toIndex, double key) binarySearch(float[] a, int fromIndex, int toIndex, float key) binarySearch(int[] a, int fromIndex, int toIndex, int key) binarySearch(long[] a, int fromIndex, int toIndex, long key) binarySearch(Object[] a, int fromIndex, int toIndex, Object key) binarySearch(T[] a, int fromIndex, int toIndex, T key, Comparator c) > [classlib][luni] java.util.Arrays.binarySearch(short[] array, int startIndex, int endIndex, short value) should return (-(insertion point) - 1) rather than -1 if value is not found in the given range > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > > Key: HARMONY-6139 > URL: https://issues.apache.org/jira/browse/HARMONY-6139 > Project: Harmony > Issue Type: Bug > Components: Classlib > Affects Versions: 5.0M8 > Reporter: Kevin Zhou > Fix For: 5.0M9 > > > Given a test case [1] below, RI passes while HY6 fails. > The testcase is used to test the binarySearch(short[] array, int startIndex, int endIndex, short value) of java.util.Arrays class. > According to java spec, if the given value is not found in the given range of array, this method should return (-(insertion point) - 1) rather than -1. > Here, "insertion point" is defined as the point at which the key would be inserted into the array or endIndex if all elements in the range are less than the specified key. And HY6 doesn't implement this. > [1] Test Case: > public void test_Arrays_binaraySearch_short() { > assertEquals(-2, Arrays.binarySearch(new short[] { (short) -1 }, 1, 1, (short)0)); > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.