-
Bug
-
Resolution: Fixed
-
P3
-
1.2.0
-
1.2fcs
-
sparc
-
solaris_2.5
-
Verified
Name: dfC67450 Date: 05/27/98
java.util.GregorianCalendar.roll(int field, boolean up) throws ArrayIndexOutOfBounds
instead of IllegalArgument exception when field < 0 or field >= FIELD_COUNT.
Javadoc says about roll(int field, boolean up) :
exception: IllegalArgumentException if an unknown field value is given.
Here is the test demonstrating the bug:
-----------------Test.java------------------------
import java.util.*;
public class Test {
public static void main (String args[]){
GregorianCalendar calendar = new GregorianCalendar();
try {
calendar.roll(-1, true);
System.out.println("Test failed, no exception trown");
} catch (IllegalArgumentException e) {
System.out.println("Test passed");
} catch (Exception e) {
System.out.println("Test failed. Unexpected exception is thrown");
System.out.println(e);
}
}
}
---------Output from the test---------------------
Test failed. Unexpected exception is thrown
java.lang.ArrayIndexOutOfBoundsException: -1
-------------------------------------------------
======================================================================