-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.4.2
-
x86
-
windows_2000
FULL PRODUCT VERSION :
java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
The class description of java.util.SimpleTimeZone indicates that day of month = 3, day of week = 1 means first Sunday on or after third day of month, whereas the code (and the Javadoc on the private method decodeStartRule()) reveal that this really means third Sunday of month.
Actually, the example given in the class description causes an InvalidArgumentException to be thrown, since day of month = 8 isn't between -5 and 5.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Try the following instantiation:
SimpleTimeZone tz = new SimpleTimeZone(0,"GMT",3,8,1,0,9,2,1,0);
which is valid according to the JavaDoc.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I was expecting 3,8,1 to mean "Sunday on or after the 8th of April" and the instantiation to work.
ACTUAL -
java.lang.IllegalArgumentException: Illegal start day of week in month 8
at java.util.SimpleTimeZone.decodeStartRule(SimpleTimeZone.java:1433)
at java.util.SimpleTimeZone.decodeRules(SimpleTimeZone.java:1373)
at java.util.SimpleTimeZone.<init>(SimpleTimeZone.java:341)
at java.util.SimpleTimeZone.<init>(SimpleTimeZone.java:199)
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.IllegalArgumentException: Illegal start day of week in month 8
at java.util.SimpleTimeZone.decodeStartRule(SimpleTimeZone.java:1433)
at java.util.SimpleTimeZone.decodeRules(SimpleTimeZone.java:1373)
at java.util.SimpleTimeZone.<init>(SimpleTimeZone.java:341)
at java.util.SimpleTimeZone.<init>(SimpleTimeZone.java:199)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
class TestSTZ
{
public void main(String[] args)
{
java.util.SimpleTimeZone tz = new java.util.SimpleTimeZone(0,"GMT",3,8,1,0,9,2,1,0);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
This is a documentation bug. There is no workaround.
java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
The class description of java.util.SimpleTimeZone indicates that day of month = 3, day of week = 1 means first Sunday on or after third day of month, whereas the code (and the Javadoc on the private method decodeStartRule()) reveal that this really means third Sunday of month.
Actually, the example given in the class description causes an InvalidArgumentException to be thrown, since day of month = 8 isn't between -5 and 5.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Try the following instantiation:
SimpleTimeZone tz = new SimpleTimeZone(0,"GMT",3,8,1,0,9,2,1,0);
which is valid according to the JavaDoc.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I was expecting 3,8,1 to mean "Sunday on or after the 8th of April" and the instantiation to work.
ACTUAL -
java.lang.IllegalArgumentException: Illegal start day of week in month 8
at java.util.SimpleTimeZone.decodeStartRule(SimpleTimeZone.java:1433)
at java.util.SimpleTimeZone.decodeRules(SimpleTimeZone.java:1373)
at java.util.SimpleTimeZone.<init>(SimpleTimeZone.java:341)
at java.util.SimpleTimeZone.<init>(SimpleTimeZone.java:199)
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.IllegalArgumentException: Illegal start day of week in month 8
at java.util.SimpleTimeZone.decodeStartRule(SimpleTimeZone.java:1433)
at java.util.SimpleTimeZone.decodeRules(SimpleTimeZone.java:1373)
at java.util.SimpleTimeZone.<init>(SimpleTimeZone.java:341)
at java.util.SimpleTimeZone.<init>(SimpleTimeZone.java:199)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
class TestSTZ
{
public void main(String[] args)
{
java.util.SimpleTimeZone tz = new java.util.SimpleTimeZone(0,"GMT",3,8,1,0,9,2,1,0);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
This is a documentation bug. There is no workaround.
- duplicates
-
JDK-4959485 Doc: java.util.SimpleTimeZone class javadoc contradict itself and implementation
-
- Closed
-