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

javax.accessibility.AccessibleBundle will reload the ResourceBundle for every call to toDisplayString

XMLWordPrintable

      FULL PRODUCT VERSION :
      dk1.8.0_144

      ADDITIONAL OS VERSION INFORMATION :
      Windows 10

      A DESCRIPTION OF THE PROBLEM :
      javax.accessibility.AccessibleBundle will reload the ResourceBundle for every call to toDisplayString.



      AccessibleBundle.loadResourceBundle method doesn't check properly for the key Locale, it seems you have similar bug as http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8u40-b25/javax/accessibility/AccessibleBundle.java#AccessibleBundle.toDisplayString%28%29

      The line: if (! table.contains(locale)) {
      Should say: if (! table.containsKey(locale)) {


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Use AccessibleRole.toDisplayString() and watch memory allocations with profiler.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The resource bundle should be used from the table cache every time.
      ACTUAL -
      The resource bundle is reloaded and overwritten with every call.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      workaround is to write the value of Locale to the table so it can go past the bad "if"

      Hashtable table = (Hashtable)getDeclaredField(AccessibleBundle.class, "table");

           if (table != null) {
           Locale locale = Locale.US;
           if (!table.contains(locale) && table.containsKey(locale)) {
      table.put(locale, locale);
      }
           }

            kaddepalli Krishna Addepalli
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: