You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Sean Qiu (JIRA)" <ji...@apache.org> on 2008/01/31 03:59:34 UTC

[jira] Created: (HARMONY-5446) [classlib][luni][java6] Arrays.binarySearch(Object[],Object) will throw ClassCastException while RI won't

[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.


[jira] Closed: (HARMONY-5446) [classlib][luni][java6] Arrays.binarySearch(Object[],Object) will throw ClassCastException while RI won't

Posted by "Mark Hindess (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5446?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Hindess closed HARMONY-5446.
---------------------------------

    Resolution: Invalid

It will be fixed by the business-as-usual merge of java 5 fix/test - which is correct thanks to Stepan.  Please don't open JIRA for duplicates without good reason - it just creates confusion.


> [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
>            Assignee: Mark Hindess
>         Attachments: Harmony-5446.diff
>
>
> 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.


[jira] Updated: (HARMONY-5446) [classlib][luni][java6] Arrays.binarySearch(Object[],Object) will throw ClassCastException while RI won't

Posted by "Sean Qiu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5446?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sean Qiu updated HARMONY-5446:
------------------------------

    Attachment: Harmony-5446.diff

Could someone please try this patch?Thanks 

> [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
>         Attachments: Harmony-5446.diff
>
>
> 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.


[jira] Assigned: (HARMONY-5446) [classlib][luni][java6] Arrays.binarySearch(Object[],Object) will throw ClassCastException while RI won't

Posted by "Mark Hindess (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5446?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Hindess reassigned HARMONY-5446:
-------------------------------------

    Assignee: Mark Hindess  (was: Tony Wu)

> [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
>            Assignee: Mark Hindess
>         Attachments: Harmony-5446.diff
>
>
> 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.


[jira] Assigned: (HARMONY-5446) [classlib][luni][java6] Arrays.binarySearch(Object[],Object) will throw ClassCastException while RI won't

Posted by "Tony Wu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5446?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tony Wu reassigned HARMONY-5446:
--------------------------------

    Assignee: Tony Wu

> [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
>            Assignee: Tony Wu
>         Attachments: Harmony-5446.diff
>
>
> 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.


[jira] Commented: (HARMONY-5446) [classlib][luni][java6] Arrays.binarySearch(Object[],Object) will throw ClassCastException while RI won't

Posted by "Mark Hindess (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5446?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12564346#action_12564346 ] 

Mark Hindess commented on HARMONY-5446:
---------------------------------------

Please don't apply this patch.  See my previous comment.

It is identical to the patch for HARMONY-5443 that is already committed in the java5 trunk and will in due course be merged.  Since the patch contains the same error as the patch for HARMONY-5443 - fixed by Stepan in commit r616721 - applying the patch will actually cause conflicts during a subsequent merge.

If there is some reason this is urgent, then do the trunk to branch merge instead.


> [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
>            Assignee: Tony Wu
>         Attachments: Harmony-5446.diff
>
>
> 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.


[jira] Commented: (HARMONY-5446) [classlib][luni][java6] Arrays.binarySearch(Object[],Object) will throw ClassCastException while RI won't

Posted by "Mark Hindess (JIRA)" <ji...@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.


[jira] Commented: (HARMONY-5446) [classlib][luni][java6] Arrays.binarySearch(Object[],Object) will throw ClassCastException while RI won't

Posted by "Tony Wu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5446?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12564345#action_12564345 ] 

Tony Wu commented on HARMONY-5446:
----------------------------------

I'm merging the branch and try to fix this issue in the same time.

> [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
>            Assignee: Tony Wu
>         Attachments: Harmony-5446.diff
>
>
> 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.