You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Hoying, Ken" <Ke...@PremierInc.com> on 2009/07/22 18:47:05 UTC

Upgrading xWork??

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.

RE: Upgrading xWork??

Posted by "Hoying, Ken" <Ke...@PremierInc.com>.
Thank you, Haroon.

I looked through the forum originally but may have missed the post.  I will take another look.

Thank you,
Ken 

-----Original Message-----
From: Haroon Rafique [mailto:haroon.rafique@utoronto.ca] 
Sent: Wednesday, July 22, 2009 1:25 PM
To: Struts Users Mailing List
Subject: RE: Upgrading xWork??

On Today at 1:04pm, HK=>Hoying, Ken <Ke...@PremierInc.com> wrote:

HK> [..snip..]
HK> 
HK> Does anyone have experience using an xWork version 2.1.x with Struts 2.0.11.1?
HK> 

I say this, based on no evidence other than remembering it from a thread earlier, that xwork 2.1.x is incompatiple with struts 2.0.x because of lot of internal changes. I know for sure that the other way around, i.e., struts 2.1.x will not work with xwork 2.0.x.

Later,
--
Haroon Rafique
<ha...@utoronto.ca>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org 
-----------------------------------------
***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.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Upgrading xWork??

Posted by "Hoying, Ken" <Ke...@PremierInc.com>.
Thanks, Wes.

That is our fallback plan and most likely the route we will take.

Thanks,
Ken 

-----Original Message-----
From: Wes Wannemacher [mailto:wesw@wantii.com] 
Sent: Wednesday, July 22, 2009 1:33 PM
To: Struts Users Mailing List
Subject: Re: Upgrading xWork??

I would say that you're better off grabbing the source for the version you are using and adding that fix you found and building your own copy. It's not great, but if you don't want to upgrade to struts 2.1.x, then patching is your best bet.

-Wes

On Wed, Jul 22, 2009 at 1:25 PM, Haroon
Rafique<ha...@utoronto.ca> wrote:
> On Today at 1:04pm, HK=>Hoying, Ken <Ke...@PremierInc.com> wrote:
>
> HK> [..snip..]
> HK>
> HK> Does anyone have experience using an xWork version 2.1.x with Struts 2.0.11.1?
> HK>
>
> I say this, based on no evidence other than remembering it from a 
> thread earlier, that xwork 2.1.x is incompatiple with struts 2.0.x 
> because of lot of internal changes. I know for sure that the other way 
> around, i.e., struts 2.1.x will not work with xwork 2.0.x.
>
> Later,
> --
> Haroon Rafique
> <ha...@utoronto.ca>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



--
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org 
-----------------------------------------
***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.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Upgrading xWork??

Posted by Wes Wannemacher <we...@wantii.com>.
I would say that you're better off grabbing the source for the version
you are using and adding that fix you found and building your own
copy. It's not great, but if you don't want to upgrade to struts
2.1.x, then patching is your best bet.

-Wes

On Wed, Jul 22, 2009 at 1:25 PM, Haroon
Rafique<ha...@utoronto.ca> wrote:
> On Today at 1:04pm, HK=>Hoying, Ken <Ke...@PremierInc.com> wrote:
>
> HK> [..snip..]
> HK>
> HK> Does anyone have experience using an xWork version 2.1.x with Struts 2.0.11.1?
> HK>
>
> I say this, based on no evidence other than remembering it from a thread
> earlier, that xwork 2.1.x is incompatiple with struts 2.0.x because of lot
> of internal changes. I know for sure that the other way around, i.e.,
> struts 2.1.x will not work with xwork 2.0.x.
>
> Later,
> --
> Haroon Rafique
> <ha...@utoronto.ca>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Upgrading xWork??

Posted by Haroon Rafique <ha...@utoronto.ca>.
On Today at 1:04pm, HK=>Hoying, Ken <Ke...@PremierInc.com> wrote:

HK> [..snip..]
HK> 
HK> Does anyone have experience using an xWork version 2.1.x with Struts 2.0.11.1?
HK> 

I say this, based on no evidence other than remembering it from a thread 
earlier, that xwork 2.1.x is incompatiple with struts 2.0.x because of lot 
of internal changes. I know for sure that the other way around, i.e., 
struts 2.1.x will not work with xwork 2.0.x.

Later,
--
Haroon Rafique
<ha...@utoronto.ca>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Upgrading xWork??

Posted by "Hoying, Ken" <Ke...@PremierInc.com>.
I mis-typed to Struts version we are using.  It is 2.0.11.1.

I looked at the code history and interestingly enough, this fix does not appear to be in any 2.0.x release, including the latest 2.0.7 from 11/15/08.

However, the fix is included in release 2.1.0 from 10/15/07.

Does anyone have experience using an xWork version 2.1.x with Struts 2.0.11.1?

Thank you!
Ken


-----Original Message-----
From: Hoying, Ken [mailto:Ken_Hoying@PremierInc.com]
Sent: Wednesday, July 22, 2009 12:47 PM
To: user@struts.apache.org
Subject: Upgrading xWork??

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.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Upgrading xWork??

Posted by "Hoying, Ken" <Ke...@PremierInc.com>.
The 2.1.4 code for xWork is as you posted with the synchronized block.  However, the 2.0.4 code does not contain the symbolization block.  As a result, it appears that my threads are sometimes hanging.  I am not getting any errors in the log.  What is happening on occasion (not very often) is some sort of contention will happen and user threads will start hanging.  

When a thread dump is done, the hung threads are all seem hung on the same HahsMap get() method from the call made in the line below:
	MessageFormat format = (MessageFormat) messageFormats.get(key);

The line below being from the 2.0.4 code:

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;
    } 

Thanks,
Ken

-----Original Message-----
From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Wednesday, July 22, 2009 7:38 PM
To: Struts Users Mailing List
Subject: RE: Upgrading xWork??


i'm running xwork-2.1.4

private static final Map<MessageFormatKey, MessageFormat> messageFormats = new HashMap<MessageFormatKey, MessageFormat>();  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;
    }
//same as your latest version
can you display the synchronisation errors from the log?

thanks,
Martin
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> Date: Wed, 22 Jul 2009 13:39:02 -0700
> Subject: Re: Upgrading xWork??
> From: thechrispratt@gmail.com
> To: user@struts.apache.org
> 
> I'd still suggest making your changes to the 2.0.5 source, since it 
> most likely has other bug fixes that you just haven't needed yet.
>   (*Chris*)
> 
> On Wed, Jul 22, 2009 at 1:21 PM, Hoying, Ken <Ke...@premierinc.com>wrote:
> 
> > I checked and it was not.  Thank you though.  It only seems to 
> > appear in the 2.1.x versions.
> >
> > -----Original Message-----
> > From: Chris Pratt [mailto:thechrispratt@gmail.com]
> > Sent: Wednesday, July 22, 2009 4:08 PM
> > To: Struts Users Mailing List
> > Subject: Re: Upgrading xWork??
> >
> > 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_Hoying@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.
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >

_________________________________________________________________
Windows LiveT Hotmail®: Celebrate the moment with your favorite sports pics. Check it out.
http://www.windowslive.com/Online/Hotmail/Campaign/QuickAdd?ocid=TXT_TAGLM_WL_QA_HM_sports_photos_072009&cat=sports
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Upgrading xWork??

Posted by Martin Gainty <mg...@hotmail.com>.
i'm running xwork-2.1.4

private static final Map<MessageFormatKey, MessageFormat> messageFormats = new HashMap<MessageFormatKey, MessageFormat>();
 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;
    }
//same as your latest version
can you display the synchronisation errors from the log?

thanks,
Martin 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> Date: Wed, 22 Jul 2009 13:39:02 -0700
> Subject: Re: Upgrading xWork??
> From: thechrispratt@gmail.com
> To: user@struts.apache.org
> 
> I'd still suggest making your changes to the 2.0.5 source, since it most
> likely has other bug fixes that you just haven't needed yet.
>   (*Chris*)
> 
> On Wed, Jul 22, 2009 at 1:21 PM, Hoying, Ken <Ke...@premierinc.com>wrote:
> 
> > I checked and it was not.  Thank you though.  It only seems to appear in
> > the 2.1.x versions.
> >
> > -----Original Message-----
> > From: Chris Pratt [mailto:thechrispratt@gmail.com]
> > Sent: Wednesday, July 22, 2009 4:08 PM
> > To: Struts Users Mailing List
> > Subject: Re: Upgrading xWork??
> >
> > 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_Hoying@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.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >

_________________________________________________________________
Windows Live™ Hotmail®: Celebrate the moment with your favorite sports pics. Check it out.
http://www.windowslive.com/Online/Hotmail/Campaign/QuickAdd?ocid=TXT_TAGLM_WL_QA_HM_sports_photos_072009&cat=sports

Re: Upgrading xWork??

Posted by Chris Pratt <th...@gmail.com>.
I'd still suggest making your changes to the 2.0.5 source, since it most
likely has other bug fixes that you just haven't needed yet.
  (*Chris*)

On Wed, Jul 22, 2009 at 1:21 PM, Hoying, Ken <Ke...@premierinc.com>wrote:

> I checked and it was not.  Thank you though.  It only seems to appear in
> the 2.1.x versions.
>
> -----Original Message-----
> From: Chris Pratt [mailto:thechrispratt@gmail.com]
> Sent: Wednesday, July 22, 2009 4:08 PM
> To: Struts Users Mailing List
> Subject: Re: Upgrading xWork??
>
> 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_Hoying@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.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

RE: Upgrading xWork??

Posted by "Hoying, Ken" <Ke...@PremierInc.com>.
I checked and it was not.  Thank you though.  It only seems to appear in the 2.1.x versions. 

-----Original Message-----
From: Chris Pratt [mailto:thechrispratt@gmail.com] 
Sent: Wednesday, July 22, 2009 4:08 PM
To: Struts Users Mailing List
Subject: Re: Upgrading xWork??

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 <Ke...@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.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Upgrading xWork??

Posted by Chris Pratt <th...@gmail.com>.
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 <Ke...@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.