You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Anton Luht (JIRA)" <ji...@apache.org> on 2006/07/13 13:15:29 UTC

[jira] Created: (HARMONY-866) Arrays.binarySearch should always return -1on empty array

Arrays.binarySearch should always return -1on empty array
---------------------------------------------------------

         Key: HARMONY-866
         URL: http://issues.apache.org/jira/browse/HARMONY-866
     Project: Harmony
        Type: Bug

  Components: Non-bug differences from RI  
 Environment: Windows XP
    Reporter: Anton Luht
    Priority: Minor
 Attachments: patch.txt

Harmony: classlib + VM revision 421248

If we try to find a non-comparable item in an empty array, RI returns -1 while Harmony throws ClassCastException. 

Code to reproduce:

import java.util.*;

public class Test {
    public static void main (String[] args) {  
        System.err.println(Arrays.binarySearch(new Object[] {}, new Object()) == -1 ? "PASSED" : "FAILED");
    } 
}
-------

Please see the patch with unit test for this case and fix for classlib code attached

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (HARMONY-866) Arrays.binarySearch should always return -1on empty array

Posted by "spark shen (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-866?page=all ]

spark shen updated HARMONY-866:
-------------------------------

    Attachment: Harmony-866.diff

This is the new patch. Would you please have a try?

Best regards

> Arrays.binarySearch should always return -1on empty array
> ---------------------------------------------------------
>
>                 Key: HARMONY-866
>                 URL: http://issues.apache.org/jira/browse/HARMONY-866
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: Windows XP
>            Reporter: Anton Luht
>            Priority: Minor
>         Attachments: Harmony-866.diff, patch.txt
>
>
> Harmony: classlib + VM revision 421248
> If we try to find a non-comparable item in an empty array, RI returns -1 while Harmony throws ClassCastException. 
> Code to reproduce:
> import java.util.*;
> public class Test {
>     public static void main (String[] args) {  
>         System.err.println(Arrays.binarySearch(new Object[] {}, new Object()) == -1 ? "PASSED" : "FAILED");
>     } 
> }
> -------
> Please see the patch with unit test for this case and fix for classlib code attached

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-866) Arrays.binarySearch should always return -1on empty array

Posted by "Anton Luht (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-866?page=comments#action_12434649 ] 
            
Anton Luht commented on HARMONY-866:
------------------------------------

I've applied this patch successfully to r443308 - it solved the problem.

> Arrays.binarySearch should always return -1on empty array
> ---------------------------------------------------------
>
>                 Key: HARMONY-866
>                 URL: http://issues.apache.org/jira/browse/HARMONY-866
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: Windows XP
>            Reporter: Anton Luht
>            Priority: Minor
>         Attachments: Harmony-866.diff, patch.txt
>
>
> Harmony: classlib + VM revision 421248
> If we try to find a non-comparable item in an empty array, RI returns -1 while Harmony throws ClassCastException. 
> Code to reproduce:
> import java.util.*;
> public class Test {
>     public static void main (String[] args) {  
>         System.err.println(Arrays.binarySearch(new Object[] {}, new Object()) == -1 ? "PASSED" : "FAILED");
>     } 
> }
> -------
> Please see the patch with unit test for this case and fix for classlib code attached

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Resolved: (HARMONY-866) Arrays.binarySearch should always return -1on empty array

Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-866?page=all ]

Paulex Yang resolved HARMONY-866.
---------------------------------

    Resolution: Fixed

Spark, patch applied at revision r447282, thanks a lot for this enhancement.

Anton, please verify that the problem is fully fixed as you expected.


> Arrays.binarySearch should always return -1on empty array
> ---------------------------------------------------------
>
>                 Key: HARMONY-866
>                 URL: http://issues.apache.org/jira/browse/HARMONY-866
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: Windows XP
>            Reporter: Anton Luht
>         Assigned To: Paulex Yang
>            Priority: Minor
>         Attachments: Harmony-866.diff, patch.txt
>
>
> Harmony: classlib + VM revision 421248
> If we try to find a non-comparable item in an empty array, RI returns -1 while Harmony throws ClassCastException. 
> Code to reproduce:
> import java.util.*;
> public class Test {
>     public static void main (String[] args) {  
>         System.err.println(Arrays.binarySearch(new Object[] {}, new Object()) == -1 ? "PASSED" : "FAILED");
>     } 
> }
> -------
> Please see the patch with unit test for this case and fix for classlib code attached

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (HARMONY-866) Arrays.binarySearch should always return -1on empty array

Posted by "Nathan Beyer (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-866?page=all ]

Nathan Beyer updated HARMONY-866:
---------------------------------

    Component/s: Classlib
                     (was: Non-bug differences from RI)

> Arrays.binarySearch should always return -1on empty array
> ---------------------------------------------------------
>
>                 Key: HARMONY-866
>                 URL: http://issues.apache.org/jira/browse/HARMONY-866
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: Windows XP
>            Reporter: Anton Luht
>            Priority: Minor
>         Attachments: patch.txt
>
>
> Harmony: classlib + VM revision 421248
> If we try to find a non-comparable item in an empty array, RI returns -1 while Harmony throws ClassCastException. 
> Code to reproduce:
> import java.util.*;
> public class Test {
>     public static void main (String[] args) {  
>         System.err.println(Arrays.binarySearch(new Object[] {}, new Object()) == -1 ? "PASSED" : "FAILED");
>     } 
> }
> -------
> Please see the patch with unit test for this case and fix for classlib code attached

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (HARMONY-866) Arrays.binarySearch should always return -1on empty array

Posted by "Anton Luht (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-866?page=all ]

Anton Luht updated HARMONY-866:
-------------------------------

    Attachment: patch.txt

patch

> Arrays.binarySearch should always return -1on empty array
> ---------------------------------------------------------
>
>          Key: HARMONY-866
>          URL: http://issues.apache.org/jira/browse/HARMONY-866
>      Project: Harmony
>         Type: Bug

>   Components: Non-bug differences from RI
>  Environment: Windows XP
>     Reporter: Anton Luht
>     Priority: Minor
>  Attachments: patch.txt
>
> Harmony: classlib + VM revision 421248
> If we try to find a non-comparable item in an empty array, RI returns -1 while Harmony throws ClassCastException. 
> Code to reproduce:
> import java.util.*;
> public class Test {
>     public static void main (String[] args) {  
>         System.err.println(Arrays.binarySearch(new Object[] {}, new Object()) == -1 ? "PASSED" : "FAILED");
>     } 
> }
> -------
> Please see the patch with unit test for this case and fix for classlib code attached

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (HARMONY-866) Arrays.binarySearch should always return -1on empty array

Posted by "spark shen (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-866?page=comments#action_12434579 ] 
            
spark shen commented on HARMONY-866:
------------------------------------

I suggest to change the component attribute to classlib, since RI's behavior makes sense here.
Refer to thread '[OLD JIRA]Deal with 780 866 1367 according to discussion'


> Arrays.binarySearch should always return -1on empty array
> ---------------------------------------------------------
>
>                 Key: HARMONY-866
>                 URL: http://issues.apache.org/jira/browse/HARMONY-866
>             Project: Harmony
>          Issue Type: Bug
>          Components: Non-bug differences from RI
>         Environment: Windows XP
>            Reporter: Anton Luht
>            Priority: Minor
>         Attachments: patch.txt
>
>
> Harmony: classlib + VM revision 421248
> If we try to find a non-comparable item in an empty array, RI returns -1 while Harmony throws ClassCastException. 
> Code to reproduce:
> import java.util.*;
> public class Test {
>     public static void main (String[] args) {  
>         System.err.println(Arrays.binarySearch(new Object[] {}, new Object()) == -1 ? "PASSED" : "FAILED");
>     } 
> }
> -------
> Please see the patch with unit test for this case and fix for classlib code attached

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (HARMONY-866) Arrays.binarySearch should always return -1on empty array

Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-866?page=all ]

Paulex Yang closed HARMONY-866.
-------------------------------


Verified by Anton and Spark.

> Arrays.binarySearch should always return -1on empty array
> ---------------------------------------------------------
>
>                 Key: HARMONY-866
>                 URL: http://issues.apache.org/jira/browse/HARMONY-866
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: Windows XP
>            Reporter: Anton Luht
>         Assigned To: Paulex Yang
>            Priority: Minor
>         Attachments: Harmony-866.diff, patch.txt
>
>
> Harmony: classlib + VM revision 421248
> If we try to find a non-comparable item in an empty array, RI returns -1 while Harmony throws ClassCastException. 
> Code to reproduce:
> import java.util.*;
> public class Test {
>     public static void main (String[] args) {  
>         System.err.println(Arrays.binarySearch(new Object[] {}, new Object()) == -1 ? "PASSED" : "FAILED");
>     } 
> }
> -------
> Please see the patch with unit test for this case and fix for classlib code attached

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-866) Arrays.binarySearch should always return -1on empty array

Posted by "Anton Luht (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-866?page=comments#action_12435428 ] 
            
Anton Luht commented on HARMONY-866:
------------------------------------

verified on build:
svn = r447316, (Sep 18 2006), Windows/ia32/msvc 1310, debug build

> Arrays.binarySearch should always return -1on empty array
> ---------------------------------------------------------
>
>                 Key: HARMONY-866
>                 URL: http://issues.apache.org/jira/browse/HARMONY-866
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: Windows XP
>            Reporter: Anton Luht
>         Assigned To: Paulex Yang
>            Priority: Minor
>         Attachments: Harmony-866.diff, patch.txt
>
>
> Harmony: classlib + VM revision 421248
> If we try to find a non-comparable item in an empty array, RI returns -1 while Harmony throws ClassCastException. 
> Code to reproduce:
> import java.util.*;
> public class Test {
>     public static void main (String[] args) {  
>         System.err.println(Arrays.binarySearch(new Object[] {}, new Object()) == -1 ? "PASSED" : "FAILED");
>     } 
> }
> -------
> Please see the patch with unit test for this case and fix for classlib code attached

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Assigned: (HARMONY-866) Arrays.binarySearch should always return -1on empty array

Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-866?page=all ]

Paulex Yang reassigned HARMONY-866:
-----------------------------------

    Assignee: Paulex Yang

> Arrays.binarySearch should always return -1on empty array
> ---------------------------------------------------------
>
>                 Key: HARMONY-866
>                 URL: http://issues.apache.org/jira/browse/HARMONY-866
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: Windows XP
>            Reporter: Anton Luht
>         Assigned To: Paulex Yang
>            Priority: Minor
>         Attachments: Harmony-866.diff, patch.txt
>
>
> Harmony: classlib + VM revision 421248
> If we try to find a non-comparable item in an empty array, RI returns -1 while Harmony throws ClassCastException. 
> Code to reproduce:
> import java.util.*;
> public class Test {
>     public static void main (String[] args) {  
>         System.err.println(Arrays.binarySearch(new Object[] {}, new Object()) == -1 ? "PASSED" : "FAILED");
>     } 
> }
> -------
> Please see the patch with unit test for this case and fix for classlib code attached

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira