Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 68885 invoked from network); 31 Jan 2008 07:59:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 31 Jan 2008 07:59:58 -0000 Received: (qmail 96633 invoked by uid 500); 31 Jan 2008 07:59:49 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 96620 invoked by uid 500); 31 Jan 2008 07:59:49 -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 96611 invoked by uid 99); 31 Jan 2008 07:59:49 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Jan 2008 23:59:49 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Jan 2008 07:59:43 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 8EAD471423E for ; Wed, 30 Jan 2008 23:59:35 -0800 (PST) Message-ID: <21931718.1201766375581.JavaMail.jira@brutus> Date: Wed, 30 Jan 2008 23:59:35 -0800 (PST) From: "Mark Hindess (JIRA)" To: commits@harmony.apache.org Subject: [jira] Commented: (HARMONY-5446) [classlib][luni][java6] Arrays.binarySearch(Object[],Object) will throw ClassCastException while RI won't In-Reply-To: <33428048.1201748374128.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/HARMONY-5446?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12564330#action_12564330 ] Mark Hindess commented on HARMONY-5446: --------------------------------------- Sean, How is this different from the related java5 bug? Are you saying it wont be fixed when the java5 fix is merge to the java6 branch? If so, then I look forward to seeing a patch, but if not then I think we should just close this jira as it is effectively already fixed. > [classlib][luni][java6] Arrays.binarySearch(Object[],Object) will throw ClassCastException while RI won't > --------------------------------------------------------------------------------------------------------- > > Key: HARMONY-5446 > URL: https://issues.apache.org/jira/browse/HARMONY-5446 > Project: Harmony > Issue Type: Bug > Components: Classlib > Reporter: Sean Qiu > > Harmony's Arrays.binarySearch(Object[],Object o) will throw ClassCastException when second parameter does not implement Comparable interface. > It means that RI will call compareTo from the first parameter rather than the second parameter. > Here is the test case > --------------------------------- > public class MethodTest extends TestCase { > public void testMethod() throws Exception{ > Object object = new Object(); > Object[] objects = new MockComparable[] { new MockComparable() }; > assertEquals("Should always return 0", 0, Arrays.binarySearch(objects, object)); > } > static class MockComparable implements Comparable{ > public int compareTo(Object o) { > return 0; > } > } > } > ------------------------------ > Result: > RI passed > Harmony failed > ------------------------------ > Java 5 relate: HARMONY-5443 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.