If I remember correctly there was a 2.0.5 that was probably compatible with
the 2.0.x versions of Struts 2, but I have no idea if that fix is in that
version.
  (*Chris*)


On Wed, Jul 22, 2009 at 9:47 AM, Hoying, Ken <ken_hoy...@premierinc.com>wrote:

> We are running with Struts 2.0.1.1 (which uses xWork 2.0.4) and are
> noticing that we are getting hung threads sometimes on a HashMap call from
> com.opensymphony.xwork2.util.LocalizedTextUtil.
>
> It looks like the xWork code is question needs to be synchronized and is
> causing the threads to lock due to corruption in the HashMap.  The problem
> code from xWork 2.0.4 is:
>
> 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;
>    }
>
> I noticed that in later version of xWork this appears to have been fixed by
> the following change:
>
> private static MessageFormat buildMessageFormat(String pattern, Locale
> locale) {
>             MessageFormatKey key = new MessageFormatKey(pattern, locale);
>             MessageFormat format = null;
>             synchronized(messageFormats) {
>                 format = (MessageFormat) messageFormats.get(key);
>                 if (format == null) {
>                     format = new MessageFormat(pattern);
>                     format.setLocale(locale);
>                     format.applyPattern(pattern);
>                     messageFormats.put(key, format);
>                 }
>             }
>
>             return format;
>         }
>
>
>
> So my question is, has anyone attempted to upgrade the xWork library to a
> later version in Struts 2.0.1.1?  And if so, what version did you use and
> what was your experience?
>
> Thank you in advance!
> Ken
>
>
>
> -----------------------------------------
> ***Note:The information contained in this message may be privileged
> and confidential and protected from disclosure. If the reader of
> this message is not the intended recipient, or an employee or agent
> responsible for delivering this message to the intended recipient,
> you are hereby notified that any dissemination, distribution or
> copying of this communication is strictly prohibited.  If you have
> received this communication in error, please notify the Sender
> immediately by replying to the message and deleting it from your
> computer.  Thank you.  Premier Inc.

Reply via email to