We're updating the issue view to help you get more done. 

ICU4J resource bundles: should not use exceptions for missing items

Description

As it turns out, we print out an exception when a locale doesn't support a
keyword – not exactly the design! This may also be a performance drain – it
appears that we are signaling the lack of a resource with an exception. Those
are fairly slow, and it doesn't help that in this case when we build
MissingResourceException we are doing a fair amount of work to compose the
exception.

Locale: ar@collation=direct
java.util.MissingResourceException: Can't find resource for bundle
com.ibm.icu.impl.ICUResourceBundleImpl$ResourceTable, key -1
at com.ibm.icu.impl.ICUResourceBundle.getWithFallback(ICUResourceBundle.java:536)
at com.ibm.icu.text.RuleBasedCollator.<init>(RuleBasedCollator.java:1634)
at com.ibm.icu.text.CollatorServiceShim$1$CollatorFactory.handleCreate(CollatorServiceShim.java:109)
at com.ibm.icu.impl.ICULocaleService$LocaleKeyFactory.create(ICULocaleService.java:438)
at com.ibm.icu.impl.ICUService.getKey(ICUService.java:461)
at com.ibm.icu.impl.ICUService.getKey(ICUService.java:380)
at com.ibm.icu.impl.ICULocaleService.get(ICULocaleService.java:85)
at com.ibm.icu.impl.ICULocaleService.get(ICULocaleService.java:65)
at com.ibm.icu.text.CollatorServiceShim.getInstance(CollatorServiceShim.java:33)
at com.ibm.icu.text.Collator.getInstance(Collator.java:428)
at GenerateCollationTests.add(GenerateCollationTests.java:75)
at GenerateCollationTests.generate(GenerateCollationTests.java:54)
at GenerateCollationTests.main(GenerateCollationTests.java:34)

The offending code is in RuleBasedCollator(ULocale locale)

}
catch (Exception e) {
e.printStackTrace();
// if failed use UCA.
}

Status

Assignee

TracBot

Reporter

TracBot

Labels

Time Needed

Days

Components

Fix versions

Priority

critical