We have some code that determines the first & last day of the week (Sunday & Saturday, respectively) and sets a couple of Date variables appropriately. When using the jdk bundled with FC4+updates, we noticed that it's returning Sunday of the next week instead of the previous Sunday. It appears as though the JVM is using Monday as the first day of the week. Using |cal.setFirstDayOfWeek(GregorianCalendar.SUNDAY)| has no effect unless the value is explicitly set to 0 which isn't a valid value afaict. The JDK from sun.com works correctly. Here's the output from the testcase. The first run is using FC4's java/javac and the second is using Sun's java/javac. The source code is attached. [cseawood@blitzwing foo]$ javac TC.java && java TC Today is : Thu Jan 26 16:40:19 PST 2006 First day of week: 1 and SUNDAY = 1 Previous Sunday is: Sun Jan 29 16:40:19 PST 2006 [cseawood@blitzwing foo]$ /opt/java/java/bin/javac TC.java && /opt/java/java/bin/java TC Today is : Thu Jan 26 16:40:27 PST 2006 First day of week: 1 and SUNDAY = 1 Previous Sunday is: Sun Jan 22 16:40:27 PST 2006 [cseawood@blitzwing foo]$
Created attachment 123758 [details] Testcase java source
Reassigning to Bryce Mckinlay who has experience dealing with GregorianCalendar issues.
This report targets the FC3 or FC4 products, which have now been EOL'd. Could you please check that it still applies to a current Fedora release, and either update the target product or close it ? Thanks.
[cseawood@blitzwing Incoming]$ rpm -q fedora-release fedora-release-6-4 [cseawood@blitzwing Incoming]$ javac TC.java && java TC Today is : Mon Jan 22 10:08:06 PST 2007 First day of week: 1 and SUNDAY = 1 Previous Sunday is: Sun Jan 28 10:08:06 PST 2007 [cseawood@blitzwing Incoming]$ /usr/java/j2sdk1.4.2_11/bin/javac TC.java && /usr/java/j2sdk1.4.2_11/bin/java TC Today is : Mon Jan 22 10:09:10 PST 2007 First day of week: 1 and SUNDAY = 1 Previous Sunday is: Sun Jan 21 10:09:10 PST 2007 [cseawood@blitzwing Incoming]$
Use OpenJDK instead. It's available in Rawhide.