-
Bug
-
Resolution: Fixed
-
P4
-
1.3.0, 1.4.0
-
hopper
-
x86, sparc
-
solaris_8, windows_nt
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2127623 | 1.3.1_17 | Edmund Lou | P4 | Resolved | Fixed | b01 |
Name: jk109818 Date: 01/15/2002
FULL PRODUCT VERSION :
java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
OJVM Client VM (build 5.0.438 cdov, Copyright (c) 1998-2001 Oracle corp.,
nojit)
FULL OPERATING SYSTEM VERSION :
Microsoft Windows NT 4.00.1381
A DESCRIPTION OF THE PROBLEM :
get(GregorianCalendar.WEEK_OF_YEAR) for days 1.1.2000
and 1.1.1999 returns value 1, but it should be 52 (53).
2.1.2000 and 2.1.1999 returns right value 52 (53).
It works incorrectly only in a special case - see source
code.
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.*;
GregorianCalendar cal = new GregorianCalendar(2000, GregorianCalendar.JANUARY,
1);
cal.get(GregorianCalendar.DAY_OF_WEEK); // this line must be here
cal.setFirstDayOfWeek(GregorianCalendar.MONDAY);
cal.setMinimalDaysInFirstWeek(4);
System.out.println(cal.get(GregorianCalendar.WEEK_OF_YEAR));
// writes "1", but it should be "52"
---------- END SOURCE ----------
(Review ID: 138299)
======================================================================
- backported by
-
JDK-2127623 GregorianCalendar returns bad WEEK_OF_YEAR
-
- Resolved
-
- duplicates
-
JDK-4459653 Calendar.setMinimalDaysInFirstWeek doesn't reset WEEK_OF_YEAR
-
- Closed
-
- relates to
-
JDK-4546637 Incorrect WEEK_OF_MONTH after changing First Day Of Week
-
- Resolved
-