You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Kevin Zhou (JIRA)" <ji...@apache.org> on 2009/04/07 05:21:13 UTC

[jira] Created: (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

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


[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

Posted by "Kevin Zhou (JIRA)" <ji...@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<? super T>
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.


Re: [jira] Resolved: (HARMONY-6139) [classlib][luni][java6] 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

Posted by Ray <cl...@gmail.com>.
On 4/14/2010 4:06 下午, Kevin Zhou (JIRA) wrote:
>       [ https://issues.apache.org/jira/browse/HARMONY-6139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
>
> Kevin Zhou resolved HARMONY-6139.
> ---------------------------------
>
>      Resolution: Fixed
>
> Thanks, Ray.
>
> Patch applied at r933872, please verify.
>
>    
>> [classlib][luni][java6] 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
>>
>>          Attachments: Harmony6139.diff, Harmony6139_v2.diff, Harmony6139_v3.diff
>>
>>
>> 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));
>> }
>>      
>    
patch verified, thanks!

[jira] Resolved: (HARMONY-6139) [classlib][luni][java6] 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

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

Kevin Zhou resolved HARMONY-6139.
---------------------------------

    Resolution: Fixed

Thanks, Ray.

Patch applied at r933872, please verify.

> [classlib][luni][java6] 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
>
>         Attachments: Harmony6139.diff, Harmony6139_v2.diff, Harmony6139_v3.diff
>
>
> 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.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (HARMONY-6139) [classlib][luni][java6] 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

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

Ray Chen updated HARMONY-6139:
------------------------------

    Attachment: Harmony6139_v3.diff

I have refined the patch, would please try it?  Thank you!

> [classlib][luni][java6] 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
>
>         Attachments: Harmony6139.diff, Harmony6139_v2.diff, Harmony6139_v3.diff
>
>
> 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.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (HARMONY-6139) [classlib][luni][java6] 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

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

Kevin Zhou updated HARMONY-6139:
--------------------------------

    Summary: [classlib][luni][java6] 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  (was: [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)

> [classlib][luni][java6] 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.


[jira] Updated: (HARMONY-6139) [classlib][luni][java6] 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

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

Ray Chen updated HARMONY-6139:
------------------------------

    Attachment: Harmony6139.diff

Attached patch can fix this bug.

> [classlib][luni][java6] 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
>
>         Attachments: Harmony6139.diff
>
>
> 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.


[jira] Assigned: (HARMONY-6139) [classlib][luni][java6] 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

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

Kevin Zhou reassigned HARMONY-6139:
-----------------------------------

    Assignee: Kevin Zhou

> [classlib][luni][java6] 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
>            Assignee: Kevin Zhou
>             Fix For: 5.0M9
>
>         Attachments: Harmony6139.diff, Harmony6139_v2.diff, Harmony6139_v3.diff
>
>
> 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.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (HARMONY-6139) [classlib][luni][java6] 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

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

Ray Chen updated HARMONY-6139:
------------------------------

    Attachment: Harmony6139_v2.diff

There are some bugs in the patch of 1st version, fixed in 2nd version

> [classlib][luni][java6] 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
>
>         Attachments: Harmony6139.diff, Harmony6139_v2.diff
>
>
> 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.