LocalizedTextUtil messageFormats cache is NOT thread safe
---------------------------------------------------------

                 Key: WW-2834
                 URL: https://issues.apache.org/struts/browse/WW-2834
             Project: Struts 2
          Issue Type: Bug
    Affects Versions: 2.0.11.2
            Reporter: Kirk Rasmussen
            Priority: Critical


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.


    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) {
            format = new MessageFormat(pattern);
            format.setLocale(locale);
            format.applyPattern(pattern);
            messageFormats.put(key, format);
        }

        return format;
    }


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to