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

KernelJRE picks wrong TimeZone

    Details

    • Subcomponent:
    • Resolved In Build:
      b03
    • CPU:
      x86
    • OS:
      windows
    • Verification:
      Verified

      Description

      KernelJRE picks wrong TimeZone.
      For the TimeZone: America/Los_Angeles and Locale :en_US
      KernalJRE picks the ZONE as GMT but it should be PST.

      <tescase>
      import java.util.*;

      public class Foo {
      private static String[] calendar_formats = {
      "%ts' (0 - 99...?)",
      "%tz (-1200 - +1200) ZONE_NUMERIC",
      "%tZ ZONE (symbol)",
      " DATE_TIME %tc (Sat Nov 04 12:02:33 EST 1999)",
              };
      public static void main(String... arg) {
      TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");
      Locale local = new Locale("en_US");
      Calendar c = new GregorianCalendar(tz, local);
      c.clear();
      c.set(1977, 10, 15);
      StringBuffer sb = new StringBuffer(58);
      Formatter formatter = new Formatter(sb);
      for(String format: calendar_formats) {
      formatter.format(format+" \n",c);
      }
      System.out.println(sb.toString());
      }
      }
      </testcase>

      <output with kernalJRE>
      F:\Kernal>f:\jre1.6.0_02\bin\java Foo
      248400000' (0 - 99...?)
      +0000 (-1200 - +1200) ZONE_NUMERIC
      GMT ZONE (symbol)
       DATE_TIME Tue Nov 15 00:00:00 GMT 1977 (Sat Nov 04 12:02:33 EST 1999)


      F:\Kernal>f:\jre1.6.0_02\bin\java -version
      java version "1.6.0_02"
      Java(TM) SE Runtime Environment (build 1.6.0_02-b99)
      Java HotSpot(TM) Client VM (build 1.7.0-internal, mixed mode)
      </output with kernalJRE>

      <NormalJRE>
      F:\Kernal>java Foo
      248428800' (0 - 99...?)
      -0800 (-1200 - +1200) ZONE_NUMERIC
      PST ZONE (symbol)
       DATE_TIME Tue Nov 15 00:00:00 PST 1977 (Sat Nov 04 12:02:33 EST 1999)


      F:\Kernal>java -version
      java version "1.7.0-ea"
      Java(TM) SE Runtime Environment (build 1.7.0-ea-b15)
      Java HotSpot(TM) Client VM (build 1.7.0-ea-b15, mixed mode)
      </NormalJRE>
      Simplified testcase:
      <testcase>
      import java.text.*;
      import java.util.*;
      class GetInstanceTimeZone {
        public static void main(String[] args) throws Exception {
          Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("PST"));
          TimeZone tz = cal.getTimeZone();
          if (tz.getID() != "PST") {
            System.out.println("Test Failed to getInstance(TimeZone)");
            System.out.println("Expected: PST");
            System.out.println("Actual : "+tz.getID());
          }
        }
      }
      </tescase>

        Attachments

          Activity

            People

            • Assignee:
              enicholasunw Ethan Nicholas (Inactive)
              Reporter:
              savadhansunw Seetharama Avadhanam (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: