-
Bug
-
Resolution: Fixed
-
P3
-
1.2.0
-
1.2fcs
-
sparc
-
solaris_2.5
-
Verified
Name: dfC67450 Date: 05/29/98
Javadoc says about java.util.Calendar.roll(int field, boolean up):
When rolling on the month or Calendar.MONTH field, other fields like
date might conflict and, need to be changed. For instance,
rolling the month on the date 01/31/96 will result in 03/02/96.
In current implementation of GreagorianCalendar rolling the month on
the date 01/31/96 will result in 02/29/96.
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(1996, 0, 31);
System.out.println("init date: " + calendar.getTime());
calendar.roll(Calendar.MONTH, 1);
System.out.println("after rolling on month: " + calendar.getTime());
}
}
---------Output from the test---------------------
init date: Wed Jan 31 00:00:00 GMT+03:00 1996
after rolling on month: Thu Feb 29 00:00:00 GMT+03:00 1996
-------------------------------------------------
======================================================================