Bug 31784

Summary: GregorianCalendar.add() broken
Product: classpath Reporter: Jeroen Frijters <jeroen>
Component: classpathAssignee: Not yet assigned to anyone <unassigned>
Status: UNCONFIRMED ---    
Severity: normal CC: bug-classpath
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:

Description Jeroen Frijters 2007-05-02 06:54:07 UTC
Adding a year changes the day (test adapted from Apache Commons-Lang test suite):

import java.util.*;

public class test

{
  public static void main(String[] args) throws Exception
  {
    Calendar cal = Calendar.getInstance();
    cal.setTime(new Date(100, 6, 5, 4, 3, 2));
    System.out.println(cal.getTime());
    cal.add(Calendar.YEAR, 1);
    System.out.println(cal.getTime());
  }
}

Actual output:
Wed Jul 05 04:03:02 GMT+02:00 2000
Wed Jul 04 04:03:02 GMT+02:00 2001

Expected output:
Wed Jul 05 04:03:02 CEST 2000
Thu Jul 05 04:03:02 CEST 2001