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

Finnish months are formatted in long form, instead of abbreviated form

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 8u20
    • globalization

      FULL PRODUCT VERSION :
      java version "1.8.0_20"
      Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
      Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Linux 3.8.13-16.2.1.el6uek.x86_64 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      The SimpleDateFormat sometimes formats Finnish months using the full month name instead of an abbreviation, even if the format string specifies an abbreviation. This seems to occur when the format string includes a year component as well as the month.

      REGRESSION. Last worked in version 7u65

      ADDITIONAL REGRESSION INFORMATION:
      java version "1.7.0_65"
      Java(TM) SE Runtime Environment (build 1.7.0_65-b19)
      Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a SimpleDateFormat instance using format "MMM yyyy" and the Finnish locale. Use it to format a date.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      huhti 2014
      ACTUAL -
      huhtikuuta 2014

      REPRODUCIBILITY :
      This bug can be reproduced always.

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

      public class Test {
          public static void main(String[] args) {
              Locale locale = new Locale("fi", "", "");
              DateFormat format1 = new SimpleDateFormat("MMM ", locale);
              DateFormat format2 = new SimpleDateFormat("MMM yyy", locale);
              Date date = new Date();
              date.setYear(114);
              date.setDate(1);
              date.setMonth(3);
              System.out.println(format1.format(date));
              System.out.println(format2.format(date));
          }
      }

      ---------- END SOURCE ----------

            ljiang Leo Jiang (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: