-
Bug
-
Resolution: Fixed
-
P3
-
8u144, 9, 10
-
b05
-
x86
-
other
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);
}
}
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);
}
}
- relates to
-
JDK-8199400 Change Hashtable in javax.accessibility.AccessibleBundle to HashMap
-
- Open
-