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

(rb) Second attempt at loading base resource bundle fails

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 6
    • 1.3.0
    • core-libs
    • b38
    • generic
    • generic

      If you try to load the base bundle of a resource bundle family twice, the first load succeds, but the second one fails. The behavior was correct in 1.2.2, but it regressed in 1.3.

      ::::::::::::::
      BaseTwice.java
      ::::::::::::::
      import java.util.ResourceBundle;
      import java.util.Locale;

      public class BaseTwice {

          public static void main(String[] args) {
              Locale.setDefault(Locale.US);
              test();
              test();
          }
          
          private static void test() {
              ResourceBundle myResources = ResourceBundle.getBundle("RB", new Locale("
      ", ""));
              System.out.println(myResources.getString("text"));
          }
      }
      ::::::::::::::
      RB_en.properties
      ::::::::::::::
      text=Got it!


      % java13 BaseTwice
      Got it!
      Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name RB, locale
              at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:707)
              at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:604)
              at java.util.ResourceBundle.getBundle(ResourceBundle.java:559)
              at BaseTwice.test(BaseTwice.java:13)
              at BaseTwice.main(BaseTwice.java:9)

            okutsu Masayoshi Okutsu
            nlindenbsunw Norbert Lindenberg (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: