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

Calendar.getDisplayName(...): Returns null when provider is SPI but there is no SPI implementation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • 8
    • core-libs
    • Any platform that supports Java.
      JDK8 b61

    • b61
    • 8
    • b65
    • generic
    • generic
    • Verified

      Run the attached test program, with -Djava.locale.providers=SPI, but no implementation of CalendarDataProvider is in the java extension directory. In this case, the value got from JRE adapter should be returned, but the returned value is null.

      This only happens when type is STANDALONE. For example, String sunday = cal.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.SHORT_STANDALONE, new Locale(args[0], args[1]));

      If the type is not STANDALONE, for example, String sunday = cal.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.SHORT_FORMAT, new Locale(args[0], args[1])), the return value will be from JRE, not null.

      For other methods like getFirstDayOfWeek(), program still returns the value from JRE adapter, when there is no SPI implementation.

      Attached is the screen shot of program output.

            naoto Naoto Sato
            yhuang Yong Huang (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: