harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Ellison (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (HARMONY-19) Divide by zero exception when rotating an empty List
Date Thu, 19 Jan 2006 15:53:43 GMT
     [ http://issues.apache.org/jira/browse/HARMONY-19?page=all ]
     
Tim Ellison resolved HARMONY-19:
--------------------------------

    Resolution: Fixed

George, your patch and test case look good.

Fixed in luni module, java/util/Collections.java at repo revision 370506.

Please verify that it fully resolves your problem.

> Divide by zero exception when rotating an empty List
> ----------------------------------------------------
>
>          Key: HARMONY-19
>          URL: http://issues.apache.org/jira/browse/HARMONY-19
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>  Environment: All
>     Reporter: George Harley
>     Assignee: Tim Ellison
>     Priority: Minor
>  Attachments: HARMONY-19-patch-20051202.txt
>
> The implementation of method rotate(List, int) in java.util.Collections is not
> checking the size of the input list prior to attempting the rotation. As a 
> result, when called with an empty List argument a java.lang.ArithmeticException
> will occur because of the the subsequent divide by zero operation. 
> The problem can be demonstrated in the below unit test case ...
> 	public void testRotateEmptyList() {
> 		// Create an *empty* list
> 		List list = new ArrayList();
> 		try {
> 			Collections.rotate(list, 25);
> 		} catch (Exception e) {
> 			fail("Unexpected exception rotating empty List : " + e);
> 		}
> 	}

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


Mime
View raw message