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

java.util.MissingResourceException when "-Djava.locale.providers=CLDR" specified

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Not an Issue
    • Affects Version/s: 8
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0"
      Java(TM) SE Runtime Environment (build 1.8.0-b132)
      Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [版本 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      Exception is thrown when "-Djava.locale.providers=CLDR" is specified for certain DecimalFormat and NumberFormat operations.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Download icu4j-51_1.jar and icu4j-localespi-51_1.jar via following URL
           http://download.icu-project.org/files/icu4j/51.1/
      2. Create ext directory and put downloaded files into ext directory

      3. Compile and run testcase (the test case is in "Source code section" with following options
         $ java -Djava.ext.dirs=$PWD/ext -Djava.locale.providers=CLDR NumberFormatTest



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No exception is thrown.
      ACTUAL -
      Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name sun.util.cldr.CLDRLocaleDataMetaInfo, locale
      at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1564)
      at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1387)
      at java.util.ResourceBundle.getBundle(ResourceBundle.java:845)
      at sun.util.cldr.CLDRLocaleProviderAdapter.createLanguageTagSet(CLDRLocaleProviderAdapter.java:104)
      at sun.util.locale.provider.JRELocaleProviderAdapter.getLanguageTagSet(JRELocaleProviderAdapter.java:348)
      at sun.util.locale.provider.JRELocaleProviderAdapter.getNumberFormatProvider(JRELocaleProviderAdapter.java:206)
      at sun.util.locale.provider.JRELocaleProviderAdapter.getLocaleServiceProvider(JRELocaleProviderAdapter.java:97)
      at sun.util.locale.provider.LocaleProviderAdapter.findAdapter(LocaleProviderAdapter.java:284)
      at sun.util.locale.provider.LocaleProviderAdapter.getAdapter(LocaleProviderAdapter.java:254)
      at java.text.NumberFormat.getInstance(NumberFormat.java:859)
      at java.text.NumberFormat.getInstance(NumberFormat.java:429)
      at NumberFormatTest.main(NumberFormatTest.java:22)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------

      import java.text.*;
      import java.util.*;

      public class NumberFormatTest {

        static void println(String s) {
          StringBuffer sb = new StringBuffer();
          for (char c : s.toCharArray()) {
            if ('\\' == c) {
              sb.append("\\\\");
            } else if (c >= 0x20 && c <= 0x7E) {
              sb.append(c);
            } else {
              sb.append(String.format("\\u%04X", (int) c));
            }
          }
          System.out.println(sb.toString());
        }

        public static void main(String[] args) {
          DecimalFormat df = (DecimalFormat) NumberFormat.getInstance();
          println("General: toLocalizedPattern=" + df.toLocalizedPattern() + ", toPattern=" + df.toPattern());
          df = (DecimalFormat) NumberFormat.getNumberInstance();
          println("Number: toLocalizedPattern=" + df.toLocalizedPattern() + ", toPattern=" + df.toPattern());
          df = (DecimalFormat) NumberFormat.getIntegerInstance();
          println("Integer: toLocalizedPattern=" + df.toLocalizedPattern() + ", toPattern=" + df.toPattern());
          df = (DecimalFormat) NumberFormat.getCurrencyInstance();
          println("Currency: toLocalizedPattern=" + df.toLocalizedPattern() + ", toPattern=" + df.toPattern());
          df = (DecimalFormat) NumberFormat.getPercentInstance();
          println("Percent: toLocalizedPattern=" + df.toLocalizedPattern() + ", toPattern=" + df.toPattern());
        }
      }

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

        Attachments

          Activity

            People

            • Assignee:
              naoto Naoto Sato
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: