Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4510180

jdk regression: TimeZone.getAvailableIDs(int) returns wrong id

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • None
    • 1.4.0
    • core-libs



      Name: auR10023 Date: 10/03/2001


      java.util.TimeZone.getAvailableIDs(int) returns id of the time zone with
      wrong raw offset.

      Here is the example:

      ----test.java----
      import java.util.*;

      class test {
          public static void main(String args[]) {
              String [] availableIDs = TimeZone.getAvailableIDs();

              for(int i = 0; i < availableIDs.length; i++) {
                  TimeZone tz = TimeZone.getTimeZone(availableIDs[i]);
                  String [] IDs = TimeZone.getAvailableIDs(tz.getRawOffset());

                  for (int j = 0; j < IDs.length; j++) {
                      TimeZone curTZ = TimeZone.getTimeZone(IDs[j]);
                      if (tz.getRawOffset() != curTZ.getRawOffset()) {
                          System.out.println("Method TimeZone.getAvailableIDs(" +
                                             tz.getRawOffset() + ") returns " +
                                             "TimeZoneID=" + curTZ.getID() +
                                             ". Corresponding time zone has wrong" +
                                             " rawOffset=" + curTZ.getRawOffset());
                          return;
                      }
                  }
              }
              System.out.println("OKAY");
          }
      }

      #java -version
      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, interpreted mode)

      #java test
      OKAY

      #java -version
      java version "1.4.0-beta3"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b81)
      Java HotSpot(TM) Client VM (build 1.4.0-beta3-b81, mixed mode)

      #java test
      Method TimeZone.getAvailableIDs(12600000) returns TimeZoneID=MET. Corresponding time zone has wrong rawOffset=3600000


      ======================================================================

            okutsu Masayoshi Okutsu
            avusunw Avu Avu (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: