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

DateFormatSymbols: month-related methods must refer to Calendar constants

XMLWordPrintable

    • b133
    • x86
    • windows_8

      A DESCRIPTION OF THE PROBLEM :
      In the DateFormatSymbols class, the weekday-related methods always refer to the Calendar constants. As an example for getWeekdays:

      Returns:
          the weekday strings. Use Calendar.SUNDAY, Calendar.MONDAY, etc. to index the result array.

      However, the month-related methods don't refer to the Calendar constants for indexing, so it took me a long time to find out why the months array has length 13.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      getMonths
      @returns the month strings. Use Calendar.JANUARY, Calendar.FEBRUARY, etc. to index the result array.

      setMonths
      @param newMonths the new month strings. The array should be indexed by Calendar.JANUARY, Calendar.FEBRUARY, etc.

      getShortMonths
      @returns the short month strings. Use Calendar.JANUARY, Calendar.FEBRUARY, etc. to index the result array.

      setShortMonths
      @param newMonths the new short month strings. The array should be indexed by Calendar.JANUARY, Calendar.FEBRUARY, etc.

      ACTUAL -
      getMonths
      @returns the month strings.

      setMonths
      @param newMonths the new month strings.

      getShortMonths
      @returns the short month strings.

      setShortMonths
      @param newMonths the new short month strings.


      URL OF FAULTY DOCUMENTATION :
      http://docs.oracle.com/javase/8/docs/api/java/text/DateFormatSymbols.html

            nishjain Nishit Jain
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: