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

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 8
    • Component/s: core-libs
    • Labels:
    • Environment:

      Any platform that supports Java.
      JDK8 b61

    • Subcomponent:
    • Introduced In Build:
      b61
    • Introduced In Version:
      8
    • Resolved In Build:
      b65
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description

      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.

        Attachments

          Activity

            People

            • Assignee:
              naoto Naoto Sato
              Reporter:
              yhuang Yong Huang
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: