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

REGRESSION: Japanese DateFormat parser regression

XMLWordPrintable

    • tiger
    • x86
    • windows_2000
    • Verified



      Name: rmT116609 Date: 01/29/2003


      FULL PRODUCT VERSION :
      java version "1.4.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
      Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)

      FULL OPERATING SYSTEM VERSION :
      Microsoft Windows 2000 [Version 5.00.2195]

      A DESCRIPTION OF THE PROBLEM :
      The 1.4.1 JRE is now claiming that a certain "formal" Japanese date format that used to be parseable with the "FULL" style is now considered invalid. It is a format where the numeric components of the date are immediately followed by corresponding label characters for "year", "month", etc.

      By the way, I couldn't find published specs on what patterns are considered valid date/time formats for each locale, nor an API for getting them. That would be helpful.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the example on a 1.3.1_03 and 1.4.1 JRE. You get an exception on the latter. (I am told it worked on 1.4.0 too.)


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      1.3.1_03 result:
      Sat Feb 01 00:00:00 EST 2003

      1.4.1 result:
      java.text.ParseException: Unparseable date: "2003?2?1?"
              at java.text.DateFormat.parse(DateFormat.java:334)
              at Test.main(Test.java:24)

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.text.ParseException: Unparseable date: "2003?2?1?"
              at java.text.DateFormat.parse(DateFormat.java:334)
              at Test.main(Test.java:24)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.util.Locale;
      import java.util.Date;
      import java.text.DateFormat;
      import java.text.ParseException;

      public class Test {

      public static void main(String[] args)
      {
      String s = "2003\u5e742\u67081\u65e5"; // "2003y2m1d"
      Locale l = new Locale("ja", "JP");
      DateFormat dff = DateFormat.getDateInstance(DateFormat.FULL, l);
      Date d = null;
      try {
      d = dff.parse(s);
      System.out.println(d);
      } catch (ParseException e) {
      e.printStackTrace();
      }
      }

      }
      ---------- END SOURCE ----------

      Release Regression From : 1.4.0_03
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.

      (Review ID: 180503)
      ======================================================================

            kurosaki Kenichi Kurosaki (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: