Bug 179074 - GregorianCalendar setFirstDayOfWeek is broken
GregorianCalendar setFirstDayOfWeek is broken
Product: Fedora
Classification: Fedora
Component: java-1.4.2-gcj-compat (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bryce McKinlay
Depends On:
  Show dependency treegraph
Reported: 2006-01-26 19:40 EST by Chris Seawood
Modified: 2008-04-02 18:26 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-04-02 18:26:21 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Testcase java source (617 bytes, text/plain)
2006-01-26 19:40 EST, Chris Seawood
no flags Details

  None (edit)
Description Chris Seawood 2006-01-26 19:40:32 EST
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-26 19:40:33 EST
Created attachment 123758 [details]
Testcase java source
Comment 2 Thomas Fitzsimmons 2006-02-04 02:25:54 EST
Reassigning to Bryce Mckinlay who has experience dealing with GregorianCalendar
Comment 3 Christian Iseli 2007-01-22 06:54:38 EST
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 ?

Comment 4 Chris Seawood 2007-01-22 13:13:19 EST
[cseawood@blitzwing Incoming]$ rpm -q fedora-release
[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 18:26:21 EDT
Use OpenJDK instead.  It's available in Rawhide.

Note You need to log in before you can comment on or make changes to this bug.