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

Caledndar getFirstDayOfWeek returns incorrect value for en_NZ and en_AU locales

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • 10
    • 8u60, 9
    • globalization

      FULL PRODUCT VERSION :
      java version "1.8.0_60"
      Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
      Java HotSpot(TM) Client VM (build 25.60-b23, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.3.9600]

      A DESCRIPTION OF THE PROBLEM :
      when calling getFirstDayOfWeek() for a calendar object with the locale set to en_NZ or en_AU this returns 1 (SUNDAY) when it should return 2 (MONDAY)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the following code:

      import java.util.Locale;
      import java.util.Calendar;

      public class cal {
      public static void main(String[] args) {

      Locale locale = new Locale("en", "AU");
      System.out.println("Locale: '" + locale + "'");
      System.out.println("SUNDAY: " + String.valueOf(Calendar.SUNDAY));
      System.out.println("MONDAY: " + String.valueOf(Calendar.MONDAY));
              Calendar calend = Calendar.getInstance(locale);
      System.out.println("Default first week day: " + String.valueOf(calend.getFirstDayOfWeek()));
      }

      }


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Locale: 'en_AU'
      SUNDAY: 1
      MONDAY: 2
      Default first week day: 1
      ACTUAL -
      Locale: 'en_AU'
      SUNDAY: 1
      MONDAY: 2
      Default first week day: 2

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class cal {
      public static void main(String[] args) {

      Locale locale = new Locale("en", "AU");
              Calendar calend = Calendar.getInstance(locale);
      System.out.println(String.valueOf(calend.getFirstDayOfWeek()));
      }

      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      Could use setFirstDayOfWeek() method to manually set the first day of the week.

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

              Created:
              Updated:
              Resolved: