Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
2.0.11.2
-
None
-
Important
Description
Here is a snippet from com.opensymphony.xwork2.util.LocalizedTextUtil that illustrates one (could be more) problem. This could be easily fixed by using the JDK 1.5 ConcurrentHashMap collection instead. I guess technically this is an XWork problem but it is used by the default TextProvider implementation.
private static final Map messageFormats = new HashMap();
private static MessageFormat buildMessageFormat(String pattern, Locale locale) {
MessageFormatKey key = new MessageFormatKey(pattern, locale);
MessageFormat format = (MessageFormat) messageFormats.get(key);
if (format == null)
return format;
}
Also the MessageFormat class itself is not thread safe and must be syncronized.