Bug 179074

Summary: GregorianCalendar setFirstDayOfWeek is broken
Product: [Fedora] Fedora Reporter: Chris Seawood <cls>
Component: java-1.4.2-gcj-compatAssignee: Bryce McKinlay <mckinlay>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-04-02 22:26:21 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Testcase java source none

Description Chris Seawood 2006-01-27 00:40:32 UTC
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]$

Comment 1 Chris Seawood 2006-01-27 00:40:33 UTC
Created attachment 123758 [details]
Testcase java source

Comment 2 Thomas Fitzsimmons 2006-02-04 07:25:54 UTC
Reassigning to Bryce Mckinlay who has experience dealing with GregorianCalendar
issues.


Comment 3 Christian Iseli 2007-01-22 11:54:38 UTC
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.

Comment 4 Chris Seawood 2007-01-22 18:13:19 UTC
[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]$

Comment 5 Thomas Fitzsimmons 2008-04-02 22:26:21 UTC
Use OpenJDK instead.  It's available in Rawhide.