-
Bug
-
Resolution: Fixed
-
P4
-
1.4.2
-
b28
-
generic, x86
-
generic, windows_2000
Name: rmT116609 Date: 05/08/2003
FULL PRODUCT VERSION :
java version "1.4.2-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b19)
Java HotSpot(TM) Client VM (build 1.4.2-beta-b19, mixed mode)
FULL OS VERSION :
debian linux 3.0
EXTRA RELEVANT SYSTEM CONFIGURATION :
Reproduced under sdk 1.4.2beta
A DESCRIPTION OF THE PROBLEM :
cal.get(Calendar.DAY_OF_WEEK) yiedls incorrect day of week if it was initialized with another day_of_week.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
TestCase available
EXPECTED VERSUS ACTUAL BEHAVIOR :
Should print no bug
Calendar.MONDAY == cal.get(Calendar.DAY_OF_WEEK)
Prints bug
Calendar.MONDAY != cal.get(Calendar.DAY_OF_WEEK)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.Calendar;
import java.util.TimeZone;
import java.util.Locale;
/** Exposes a bug in sdk 1.4.2beta. Works in previous jdks*/
public class CalendarBug {
public static void main(String[] args) {
// bug also encounted in other locales
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT+0"),Locale.US);
cal.set(Calendar.DAY_OF_WEEK,Calendar.TUESDAY);
cal.setTime(cal.getTime());
cal.set(Calendar.HOUR_OF_DAY,11);
cal.getTime();
cal.set(Calendar.DAY_OF_WEEK,Calendar.MONDAY);
if (Calendar.MONDAY != cal.get(Calendar.DAY_OF_WEEK)) {
System.out.println("Bug: day_of_week changed.");
} else {
System.out.println("No bug.");
}
}
}
---------- END SOURCE ----------
Release Regression From : 1.4.1_02
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
(Review ID: 183562)
======================================================================
- duplicates
-
JDK-5079643 set Calendar.DAY_OF_WEEK does not work in some cases
-
- Closed
-
- relates to
-
JDK-4685354 Handling of Calendar fields setting state is broken
-
- Resolved
-
-
JDK-6289214 (cal) Calendar returns bad values if a first get is not call before a set of a weekday
-
- Closed
-
-
JDK-4851640 Calling get(...) / getTime() on a Calendar instance makes isSet(...) useless!
-
- Resolved
-