struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kirk Rasmussen (JIRA)" <>
Subject [jira] Created: (WW-2834) LocalizedTextUtil messageFormats cache is NOT thread safe
Date Wed, 08 Oct 2008 22:13:36 GMT
LocalizedTextUtil messageFormats cache is NOT thread safe

                 Key: WW-2834
             Project: Struts 2
          Issue Type: Bug
    Affects Versions:
            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);
            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.

View raw message