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

ULocale.forLocale CACHE ineffective

Description

The CACHE HashMap used in conjunction with ULocale.forLocale is completely
ineffective due to problematic conditional tests in the forLocale method. In
essence, a non-null value retrieved from the CACHE map is always ignored and a
new ULocale instance is always created. To fix, change the logic in forLocale
from:

1 2 3 4 5 6 7 ULocale result = (ULocale)CACHE.get(loc); if (result == null && defaultULocale != null && loc == defaultULocale.locale) { result = defaultULocale; } else { result = new ULocale(loc.toString(), loc); }

to:

1 2 3 4 5 6 7 8 ULocale result = (ULocale)CACHE.get(loc); if (result == null) { if (defaultULocale != null && loc == defaultULocale.locale) { result = defaultULocale; } else { result = new ULocale(loc.toString(), loc); } }

Environment

Status

Assignee

Douglas Felt

Reporter

TracBot

Time Needed

Hours

tracCreated

Apr 05, 2006, 4:49 PM

tracOwner

doug

tracProject

ICU4J

tracReporter

olsok@509bb288e0e9f23b

tracStatus

accepted

tracWeeks

0.1

Components

Priority

minor