-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
8, 9
-
generic
-
generic
FULL PRODUCT VERSION :
java 1.8_66
ADDITIONAL OS VERSION INFORMATION :
Widnows 7 64bits
A DESCRIPTION OF THE PROBLEM :
The same operations performed on Calendar instance produce different result if the getTime() method is called between steps (check the test case).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the test case.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Fri Aug 05 15:21:03 CEST 2016
Fri Aug 05 15:21:03 CEST 2016
ACTUAL -
Performing the same operations in the same order ends with different dates:
Fri Aug 05 15:21:03 CEST 2016
Fri Jul 15 15:21:03 CEST 2016
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Calendar cal = Calendar.getInstance();
cal.set(Calendar.MONTH,6);
cal.set(Calendar.DAY_OF_MONTH,1);
cal.set(Calendar.DAY_OF_WEEK,Calendar.FRIDAY);
cal.add(Calendar.WEEK_OF_MONTH,2);
System.out.println(cal.getTime());
cal = Calendar.getInstance();
cal.set(Calendar.MONTH,6);
cal.set(Calendar.DAY_OF_MONTH,1);
cal.getTime(); //<---- here is the difference between blocks
cal.set(Calendar.DAY_OF_WEEK,Calendar.FRIDAY);
cal.add(Calendar.WEEK_OF_MONTH,2);
System.out.println(cal.getTime());
---------- END SOURCE ----------
java 1.8_66
ADDITIONAL OS VERSION INFORMATION :
Widnows 7 64bits
A DESCRIPTION OF THE PROBLEM :
The same operations performed on Calendar instance produce different result if the getTime() method is called between steps (check the test case).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the test case.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Fri Aug 05 15:21:03 CEST 2016
Fri Aug 05 15:21:03 CEST 2016
ACTUAL -
Performing the same operations in the same order ends with different dates:
Fri Aug 05 15:21:03 CEST 2016
Fri Jul 15 15:21:03 CEST 2016
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Calendar cal = Calendar.getInstance();
cal.set(Calendar.MONTH,6);
cal.set(Calendar.DAY_OF_MONTH,1);
cal.set(Calendar.DAY_OF_WEEK,Calendar.FRIDAY);
cal.add(Calendar.WEEK_OF_MONTH,2);
System.out.println(cal.getTime());
cal = Calendar.getInstance();
cal.set(Calendar.MONTH,6);
cal.set(Calendar.DAY_OF_MONTH,1);
cal.getTime(); //<---- here is the difference between blocks
cal.set(Calendar.DAY_OF_WEEK,Calendar.FRIDAY);
cal.add(Calendar.WEEK_OF_MONTH,2);
System.out.println(cal.getTime());
---------- END SOURCE ----------