FULL PRODUCT VERSION :
Compiled using 1.6 or 1.7, Execution environment 1.6/1.7 JRE7 (JDK7u1)
A DESCRIPTION OF THE PROBLEM :
When I try to set a date on Calender object to a post Gregorian Calendar cutoff date, date with JRE6 jumps from Oct 5 1582 to Oct 17 1582 while that with JRE7 jumps from Oct 5 1582 to Oct 15 1582.
Is behavior of 1.7 a bug fix or a regression? I could not find release notes talking about this change.
REGRESSION. Last worked in version 7
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.TimeZone;
public class getDateRepro {
public static void main(String[] args) {
long tm = 0;
GregorianCalendar cal = new GregorianCalendar(TimeZone.getDefault(), Locale.US);
cal.setLenient(true);
cal.clear();
for (int i = 577735; i<= 577738; i=i+1)
{
cal.set(1, Calendar.JANUARY, 1 + i, 0, 0, 0);
cal.set(Calendar.MILLISECOND, 0);
tm = cal.getTimeInMillis();
java.sql.Date dt = new java.sql.Date(tm);
System.out.println("Days since base date " + i + ": " + tm + " *** " + dt.toString());
}
}
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
// With JRE 6 Java EE 1.6
// Days since base date 577735: -12219436800000 *** 1582-10-03
// Days since base date 577736: -12219350400000 *** 1582-10-04
// Days since base date 577737: -12219091200000 *** 1582-10-17
// Days since base date 577738: -12219004800000 *** 1582-10-18
ACTUAL -
// With JRE 7 (Java EE 1.6 OR 1.7)
// Days since base date 577735: -12219436800000 *** 1582-10-03
// Days since base date 577736: -12219350400000 *** 1582-10-04
// Days since base date 577737: -12219264000000 *** 1582-10-15
// Days since base date 577738: -12219177600000 *** 1582-10-16
REPRODUCIBILITY :
This bug can be reproduced always.
Compiled using 1.6 or 1.7, Execution environment 1.6/1.7 JRE7 (JDK7u1)
A DESCRIPTION OF THE PROBLEM :
When I try to set a date on Calender object to a post Gregorian Calendar cutoff date, date with JRE6 jumps from Oct 5 1582 to Oct 17 1582 while that with JRE7 jumps from Oct 5 1582 to Oct 15 1582.
Is behavior of 1.7 a bug fix or a regression? I could not find release notes talking about this change.
REGRESSION. Last worked in version 7
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.TimeZone;
public class getDateRepro {
public static void main(String[] args) {
long tm = 0;
GregorianCalendar cal = new GregorianCalendar(TimeZone.getDefault(), Locale.US);
cal.setLenient(true);
cal.clear();
for (int i = 577735; i<= 577738; i=i+1)
{
cal.set(1, Calendar.JANUARY, 1 + i, 0, 0, 0);
cal.set(Calendar.MILLISECOND, 0);
tm = cal.getTimeInMillis();
java.sql.Date dt = new java.sql.Date(tm);
System.out.println("Days since base date " + i + ": " + tm + " *** " + dt.toString());
}
}
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
// With JRE 6 Java EE 1.6
// Days since base date 577735: -12219436800000 *** 1582-10-03
// Days since base date 577736: -12219350400000 *** 1582-10-04
// Days since base date 577737: -12219091200000 *** 1582-10-17
// Days since base date 577738: -12219004800000 *** 1582-10-18
ACTUAL -
// With JRE 7 (Java EE 1.6 OR 1.7)
// Days since base date 577735: -12219436800000 *** 1582-10-03
// Days since base date 577736: -12219350400000 *** 1582-10-04
// Days since base date 577737: -12219264000000 *** 1582-10-15
// Days since base date 577738: -12219177600000 *** 1582-10-16
REPRODUCIBILITY :
This bug can be reproduced always.
- relates to
-
JDK-6459836 (cal) GregorianCalendar set method provides wrong result
- Closed
-
JDK-6549953 (cal) WEEK_OF_YEAR and DAY_OF_YEAR calculation problems around Gregorian cutover
- Closed