User account creation filtered due to spam.

Bug 31784 - GregorianCalendar.add() broken
Summary: GregorianCalendar.add() broken
Status: UNCONFIRMED
Alias: None
Product: classpath
Classification: Unclassified
Component: classpath (show other bugs)
Version: unspecified
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-02 06:54 UTC by Jeroen Frijters
Modified: 2007-05-02 06:54 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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