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

1.3.1_11 only: GregorianCalendar uses wrong ERA value in non-lenient mode

XMLWordPrintable

    • b01
    • other, x86, sparc
    • solaris_2.5.1, solaris_9, windows_xp

      Name: wm7046 Date: 04/13/2004


      The following testcase fails in JDK 1.3.1_11 only. It might be a regression.

      import java.text.SimpleDateFormat;
      import java.util.Date;

      SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
      sdf.setLenient(false);
      Date d1 = sdf.parse("2004.04.02");
      Date d2 = sdf.parse("2004.04.06");
      System.out.println("A date value in PST zone:" + d1.toString());
      System.out.println("A date value in PDT zone:" + d2.toString());

      OR
      @ To make the test complete:
      @ .
      @ SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
      @ sdf2.setLenient(false);
      @ String s1 = sdf2.format(d1);
      @ String s2 = sdf2.format(d2);
      @ System.out.println("Canonical version of d1:" + s1);
      @ System.out.println("Canonical version of d2:" + s2);
      @ .
      @ Above test case will return "2004/04/02 00:00:00" for d1, and
      @ "2004/04/06 01:00:00" for d2.
      @ Ideally, both conversions should return 00:00:00 as the time component.
      (Incident Review ID: 249946)
      ======================================================================
      ###@###.### 10/11/04 18:36 GMT

            minqi Yumin Qi
            mmma Marvin Ma (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: