Name: nt126004 Date: 02/05/2003
FULL PRODUCT VERSION :
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)
FULL OPERATING SYSTEM VERSION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
With the lines below the ID "Etc/GMT-8" is treated as
GMT+8:00, and ID "Etc/GMT+8" is treated as GMT-8:00. This
seems erroneous or at least misleading.
import java.util.*;
public final class EtcTimeZone{
public static void main(String[] args) throws
java.lang.Exception{
String[] ids =
java.util.TimeZone.getAvailableIDs(-8*60*60*1000);
for(int i=0;i<ids.length;i++){
System.out.println(ids[i]);
}
// In the result there is the ID "Etc/GMT+8"
ids = java.util.TimeZone.getAvailableIDs(8*60*60*1000);
for(int i=0;i<ids.length;i++){
System.out.println(ids[i]);
}
// In the result there is the ID "Etc/GMT-8"
System.out.println();
java.util.TimeZone zone =
java.util.TimeZone.getTimeZone("Etc/GMT-8");
System.out.println(zone.getDisplayName());//result is GMT+8
zone = java.util.TimeZone.getTimeZone("Etc/GMT+8");
System.out.println(zone.getDisplayName());//result is GMT-8
}
}
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Straightforward and seems there is no need for steps of
reproducing.
EXPECTED VERSUS ACTUAL BEHAVIOR :
"Etc/GMT-8" -> GMT-8:00
"Etc/GMT+8" -> GMT+8:00
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
//The following is the reproduction of the code give above:
import java.util.*;
public final class EtcTimeZone{
public static void main(String[] args) throws java.lang.Exception{
String[] ids = java.util.TimeZone.getAvailableIDs(-8*60*60*1000);
for(int i=0;i<ids.length;i++){
System.out.println(ids[i]);
}
// In the result there is the ID "Etc/GMT+8"
ids = java.util.TimeZone.getAvailableIDs(8*60*60*1000);
for(int i=0;i<ids.length;i++){
System.out.println(ids[i]);
}
// In the result there is the ID "Etc/GMT-8"
System.out.println();
System.out.println("getting TimeZone for \"Etc/GMT-8\"");
java.util.TimeZone zone = java.util.TimeZone.getTimeZone("Etc/GMT-8");
System.out.println(zone.getDisplayName());//result is GMT+8
System.out.println("getting TimeZone for \"Etc/GMT+8\"");
zone = java.util.TimeZone.getTimeZone("Etc/GMT+8");
System.out.println(zone.getDisplayName());//result is GMT-8
}
}
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
Actually I do not use these ID's.
(Review ID: 180806)
======================================================================