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/03/20 04:19:50 UTC

[jira] Created: (HARMONY-6122) [classlib][luni] java.util.Collections.swap(List list, int i, int j) should throw IndexOutOfBoundsException when i equals to j and is also out of boundary

[classlib][luni] java.util.Collections.swap(List<?> list, int i, int j) should throw IndexOutOfBoundsException when i equals to j and is also out of boundary
-------------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-6122
                 URL: https://issues.apache.org/jira/browse/HARMONY-6122
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
    Affects Versions: 5.0M8
            Reporter: Kevin Zhou
             Fix For: 5.0M9
         Attachments: HARMONY-6122.diff

Given a test case [1], RI passes while HY fails.
The java spec specifies that java.util.Collections.wap(List<?> list, int i, int j) should throw IndexOutOfBoundsException when either i or j is out of range.

[1] Test Case:
public void test_Collections_swap_IndexOutOfBoundsException() {
try { 
Collections.swap(new ArrayList(), 3, 3); 
fail("should throw IndexOutOfBoundsException");
 } catch (IndexOutOfBoundsException e) {
 // Expected 
}
}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (HARMONY-6122) [classlib][luni] java.util.Collections.swap(List list, int i, int j) should throw IndexOutOfBoundsException when i equals to j and is also out of boundary

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

Kevin Zhou closed HARMONY-6122.
-------------------------------


Thanks, Nathan.

> [classlib][luni] java.util.Collections.swap(List<?> list, int i, int j) should throw IndexOutOfBoundsException when i equals to j and is also out of boundary
> -------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6122
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6122
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M8
>            Reporter: Kevin Zhou
>            Assignee: Nathan Beyer
>         Attachments: HARMONY-6122.diff
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Given a test case [1], RI passes while HY fails.
> The java spec specifies that java.util.Collections.wap(List<?> list, int i, int j) should throw IndexOutOfBoundsException when either i or j is out of range.
> [1] Test Case:
> public void test_Collections_swap_IndexOutOfBoundsException() {
> try { 
> Collections.swap(new ArrayList(), 3, 3); 
> fail("should throw IndexOutOfBoundsException");
>  } catch (IndexOutOfBoundsException e) {
>  // Expected 
> }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-6122) [classlib][luni] java.util.Collections.swap(List list, int i, int j) should throw IndexOutOfBoundsException when i equals to j and is also out of boundary

Posted by "Nathan Beyer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-6122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12683739#action_12683739 ] 

Nathan Beyer commented on HARMONY-6122:
---------------------------------------

The change isn't obvious to me, can you help be understand it? Please describe what's being tested to determine if the code can return without any change or exception.

> [classlib][luni] java.util.Collections.swap(List<?> list, int i, int j) should throw IndexOutOfBoundsException when i equals to j and is also out of boundary
> -------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6122
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6122
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M8
>            Reporter: Kevin Zhou
>             Fix For: 5.0M9
>
>         Attachments: HARMONY-6122.diff
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Given a test case [1], RI passes while HY fails.
> The java spec specifies that java.util.Collections.wap(List<?> list, int i, int j) should throw IndexOutOfBoundsException when either i or j is out of range.
> [1] Test Case:
> public void test_Collections_swap_IndexOutOfBoundsException() {
> try { 
> Collections.swap(new ArrayList(), 3, 3); 
> fail("should throw IndexOutOfBoundsException");
>  } catch (IndexOutOfBoundsException e) {
>  // Expected 
> }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-6122) [classlib][luni] java.util.Collections.swap(List list, int i, int j) should throw IndexOutOfBoundsException when i equals to j and is also out of boundary

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

Tim Ellison updated HARMONY-6122:
---------------------------------

    Fix Version/s: 5.0M10

> [classlib][luni] java.util.Collections.swap(List<?> list, int i, int j) should throw IndexOutOfBoundsException when i equals to j and is also out of boundary
> -------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6122
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6122
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M8
>            Reporter: Kevin Zhou
>            Assignee: Nathan Beyer
>             Fix For: 5.0M10
>
>         Attachments: HARMONY-6122.diff
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Given a test case [1], RI passes while HY fails.
> The java spec specifies that java.util.Collections.wap(List<?> list, int i, int j) should throw IndexOutOfBoundsException when either i or j is out of range.
> [1] Test Case:
> public void test_Collections_swap_IndexOutOfBoundsException() {
> try { 
> Collections.swap(new ArrayList(), 3, 3); 
> fail("should throw IndexOutOfBoundsException");
>  } catch (IndexOutOfBoundsException e) {
>  // Expected 
> }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (HARMONY-6122) [classlib][luni] java.util.Collections.swap(List list, int i, int j) should throw IndexOutOfBoundsException when i equals to j and is also out of boundary

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

Nathan Beyer reassigned HARMONY-6122:
-------------------------------------

    Assignee: Nathan Beyer

> [classlib][luni] java.util.Collections.swap(List<?> list, int i, int j) should throw IndexOutOfBoundsException when i equals to j and is also out of boundary
> -------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6122
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6122
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M8
>            Reporter: Kevin Zhou
>            Assignee: Nathan Beyer
>             Fix For: 5.0M9
>
>         Attachments: HARMONY-6122.diff
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Given a test case [1], RI passes while HY fails.
> The java spec specifies that java.util.Collections.wap(List<?> list, int i, int j) should throw IndexOutOfBoundsException when either i or j is out of range.
> [1] Test Case:
> public void test_Collections_swap_IndexOutOfBoundsException() {
> try { 
> Collections.swap(new ArrayList(), 3, 3); 
> fail("should throw IndexOutOfBoundsException");
>  } catch (IndexOutOfBoundsException e) {
>  // Expected 
> }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-6122) [classlib][luni] java.util.Collections.swap(List list, int i, int j) should throw IndexOutOfBoundsException when i equals to j and is also out of boundary

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

Kevin Zhou updated HARMONY-6122:
--------------------------------

    Attachment: HARMONY-6122.diff

Would you please help to try it?

> [classlib][luni] java.util.Collections.swap(List<?> list, int i, int j) should throw IndexOutOfBoundsException when i equals to j and is also out of boundary
> -------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6122
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6122
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M8
>            Reporter: Kevin Zhou
>             Fix For: 5.0M9
>
>         Attachments: HARMONY-6122.diff
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Given a test case [1], RI passes while HY fails.
> The java spec specifies that java.util.Collections.wap(List<?> list, int i, int j) should throw IndexOutOfBoundsException when either i or j is out of range.
> [1] Test Case:
> public void test_Collections_swap_IndexOutOfBoundsException() {
> try { 
> Collections.swap(new ArrayList(), 3, 3); 
> fail("should throw IndexOutOfBoundsException");
>  } catch (IndexOutOfBoundsException e) {
>  // Expected 
> }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-6122) [classlib][luni] java.util.Collections.swap(List list, int i, int j) should throw IndexOutOfBoundsException when i equals to j and is also out of boundary

Posted by "Nathan Beyer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-6122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12698090#action_12698090 ] 

Nathan Beyer commented on HARMONY-6122:
---------------------------------------

I'm going to tweak this a bit and just implement it per the spec - (i < 0 || i >= list.size() || j < 0 || j >= list.size()).

http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collections.html#swap(java.util.List,%20int,%20int)

> [classlib][luni] java.util.Collections.swap(List<?> list, int i, int j) should throw IndexOutOfBoundsException when i equals to j and is also out of boundary
> -------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6122
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6122
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M8
>            Reporter: Kevin Zhou
>            Assignee: Nathan Beyer
>             Fix For: 5.0M9
>
>         Attachments: HARMONY-6122.diff
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Given a test case [1], RI passes while HY fails.
> The java spec specifies that java.util.Collections.wap(List<?> list, int i, int j) should throw IndexOutOfBoundsException when either i or j is out of range.
> [1] Test Case:
> public void test_Collections_swap_IndexOutOfBoundsException() {
> try { 
> Collections.swap(new ArrayList(), 3, 3); 
> fail("should throw IndexOutOfBoundsException");
>  } catch (IndexOutOfBoundsException e) {
>  // Expected 
> }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (HARMONY-6122) [classlib][luni] java.util.Collections.swap(List list, int i, int j) should throw IndexOutOfBoundsException when i equals to j and is also out of boundary

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

Nathan Beyer resolved HARMONY-6122.
-----------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 5.0M9)

Modified version of patch applied at r764215, please verify.

> [classlib][luni] java.util.Collections.swap(List<?> list, int i, int j) should throw IndexOutOfBoundsException when i equals to j and is also out of boundary
> -------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6122
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6122
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M8
>            Reporter: Kevin Zhou
>            Assignee: Nathan Beyer
>         Attachments: HARMONY-6122.diff
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Given a test case [1], RI passes while HY fails.
> The java spec specifies that java.util.Collections.wap(List<?> list, int i, int j) should throw IndexOutOfBoundsException when either i or j is out of range.
> [1] Test Case:
> public void test_Collections_swap_IndexOutOfBoundsException() {
> try { 
> Collections.swap(new ArrayList(), 3, 3); 
> fail("should throw IndexOutOfBoundsException");
>  } catch (IndexOutOfBoundsException e) {
>  // Expected 
> }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-6122) [classlib][luni] java.util.Collections.swap(List list, int i, int j) should throw IndexOutOfBoundsException when i equals to j and is also out of boundary

Posted by "Kevin Zhou (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-6122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12696349#action_12696349 ] 

Kevin Zhou commented on HARMONY-6122:
-------------------------------------

Hi Nathan,
This testcase is used to test the swap(List<?> list, int i, int j) method of Collections class.
If i and j equal to each other and are also bigger than the size of the given list, HY should throw IndexOutOfBoundsException rather than doing nothing.

For instance, suppose we have a new ArrayList. Its size is 0, while i=3 and j=3, HY should throw the IndexOutOfBoundsException here.



> [classlib][luni] java.util.Collections.swap(List<?> list, int i, int j) should throw IndexOutOfBoundsException when i equals to j and is also out of boundary
> -------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6122
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6122
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M8
>            Reporter: Kevin Zhou
>             Fix For: 5.0M9
>
>         Attachments: HARMONY-6122.diff
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Given a test case [1], RI passes while HY fails.
> The java spec specifies that java.util.Collections.wap(List<?> list, int i, int j) should throw IndexOutOfBoundsException when either i or j is out of range.
> [1] Test Case:
> public void test_Collections_swap_IndexOutOfBoundsException() {
> try { 
> Collections.swap(new ArrayList(), 3, 3); 
> fail("should throw IndexOutOfBoundsException");
>  } catch (IndexOutOfBoundsException e) {
>  // Expected 
> }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.