You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Anton Luht (JIRA)" <ji...@apache.org> on 2006/07/27 14:52:13 UTC

[jira] Created: (HARMONY-996) Difference in behaviour of java.util.Date(int year, int month, int date) with large negative third parameter

Difference in behaviour of java.util.Date(int year, int month, int date) with large negative third parameter
------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-996
                 URL: http://issues.apache.org/jira/browse/HARMONY-996
             Project: Harmony
          Issue Type: Bug
          Components: Non-bug differences from RI
         Environment: Windows XP Professional
            Reporter: Anton Luht
            Priority: Trivial


This seem to be a bug in RI .

The following code 

import java.util.*;

public class Test  {
  public static void main (String[] args) { 
    for(int i = -116670; i > -116681; --i ) {
       System.out.println("i=" + i + "\t, date=" + new Date(2, 3, i));
    }
  } 
}           


Prints in RI:

i=-116670   , date=Sun Oct 24 00:00:00 MSK 1582
i=-116671   , date=Sat Oct 23 00:00:00 MSK 1582
i=-116672   , date=Fri Oct 22 00:00:00 MSK 1582
i=-116673   , date=Thu Oct 21 00:00:00 MSK 1582
i=-116674   , date=Wed Oct 20 00:00:00 MSK 1582
i=-116675   , date=Tue Oct 19 00:00:00 MSK 1582
i=-116676   , date=Mon Oct 18 00:00:00 MSK 1582
i=-116677   , date=Sun Oct 17 00:00:00 MSK 1582
i=-116678   , date=Sat Oct 16 00:00:00 MSK 1582
i=-116679   , date=Thu Oct 28 00:00:00 MSK 1582
i=-116680   , date=Wed Oct 27 00:00:00 MSK 1582

prints in Harmony:

i=-116670   , date=Sun Oct 24 00:00:00 MSD 1582
i=-116671   , date=Sat Oct 23 00:00:00 MSD 1582
i=-116672   , date=Fri Oct 22 00:00:00 MSD 1582
i=-116673   , date=Thu Oct 21 00:00:00 MSD 1582
i=-116674   , date=Wed Oct 20 00:00:00 MSD 1582
i=-116675   , date=Tue Oct 19 00:00:00 MSD 1582
i=-116676   , date=Mon Oct 18 00:00:00 MSD 1582
i=-116677   , date=Sun Oct 17 00:00:00 MSD 1582
i=-116678   , date=Sat Oct 16 00:00:00 MSD 1582
i=-116679   , date=Fri Oct 05 00:00:00 MSD 1582
i=-116680   , date=Thu Oct 04 00:00:00 MSD 1582


Harmony version  is a correct calendar switch

and same functionality rewritten in another way works correctly in both implementations:

import java.util.*;

public class Test  {
  public static void main (String[] args) { 
    Calendar cal = new GregorianCalendar(1582, Calendar.OCTOBER, 29);
    for(int i = 0; i < 20 ; ++i ) {
       cal.add(Calendar.HOUR, -24);
       System.out.println(cal.getTime());
    }
  } 
}           


Prints in RI:
............
Sun Oct 17 00:00:00 MSK 1582
Sat Oct 16 00:00:00 MSK 1582
Fri Oct 05 00:00:00 MSK 1582
Thu Oct 04 00:00:00 MSK 1582
......

Prints in Harmony:
.......
Sun Oct 17 00:00:00 MSD 1582
Sat Oct 16 00:00:00 MSD 1582
Fri Oct 05 00:00:00 MSD 1582
Thu Oct 04 00:00:00 MSD 1582
.......


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