You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Jeromy Evans <je...@blueskyminds.com.au> on 2008/04/11 07:48:51 UTC
i18n/TextProvider issues
I've been investigating some i18n issues in the 2.1.x branch and found
that the search algorithm used by the Text tag differs from that of UIBean.
The Text tag iterates through the ValueStack looking for the first
TextProvider and invokes getText(...) on the first found.
The UIBean executes the OGNL expression "getText(String)", which matches
this method of the first TextProvider.
This works almost all the time, but I have two issues with it:
- the inconsistent search algorithm causes inconsistent behaviour when
there's something unexpected in the stack
(https://issues.apache.org/struts/browse/WW-2539)
- the OGNL expression is slow
(https://issues.apache.org/struts/browse/WW-1681) and fragile
(https://issues.apache.org/struts/browse/WW-2511)
I'm going to remove the hardcoded OGNL expressions from UIBean and Label
and replace them with the same algorithm used by Text. I would have
proceeded without saying so but I also discovered that the TestAction
used by the unit tests relies on getText being invoked directly by OGNL
rather than its TextProvider implementation, so the consequences may be
larger that I first imagined.
Please speak up if you see any potential issues.
regards,
Jeromy Evans
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: i18n/TextProvider issues
Posted by Don Brown <do...@gmail.com>.
Neat, hard to argue with that.
Don
On Fri, Apr 11, 2008 at 4:13 PM, Jeromy Evans
<je...@blueskyminds.com.au> wrote:
>
> Don Brown wrote:
>
> > Sounds good. Are there any performance implications?
> >
> > Don
> >
> >
> >
> According to https://issues.apache.org/struts/browse/WW-1681 the
> performance implications are very significant (significantly improved).
>
> getText(String) invoked via OGNL and and getText(key, defaultValues, args)
> invoked via Text are essentially identical in the default implementation
> (TextPrroviderSupport) as both invoke LocalizedTextUtil.findText(). The
> improvement comes down to iteration through the stack to find a class vs
> ognl expression evaluation plus iteration through the stack to find a
> method.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: i18n/TextProvider issues
Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Don Brown wrote:
> Sounds good. Are there any performance implications?
>
> Don
>
>
According to https://issues.apache.org/struts/browse/WW-1681 the
performance implications are very significant (significantly improved).
getText(String) invoked via OGNL and and getText(key, defaultValues,
args) invoked via Text are essentially identical in the default
implementation (TextPrroviderSupport) as both invoke
LocalizedTextUtil.findText(). The improvement comes down to iteration
through the stack to find a class vs ognl expression evaluation plus
iteration through the stack to find a method.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: i18n/TextProvider issues
Posted by Don Brown <mr...@twdata.org>.
Sounds good. Are there any performance implications?
Don
On Fri, Apr 11, 2008 at 3:48 PM, Jeromy Evans
<je...@blueskyminds.com.au> wrote:
> I've been investigating some i18n issues in the 2.1.x branch and found that
> the search algorithm used by the Text tag differs from that of UIBean.
> The Text tag iterates through the ValueStack looking for the first
> TextProvider and invokes getText(...) on the first found.
> The UIBean executes the OGNL expression "getText(String)", which matches
> this method of the first TextProvider.
>
> This works almost all the time, but I have two issues with it:
> - the inconsistent search algorithm causes inconsistent behaviour when
> there's something unexpected in the stack
> (https://issues.apache.org/struts/browse/WW-2539)
> - the OGNL expression is slow
> (https://issues.apache.org/struts/browse/WW-1681) and fragile
> (https://issues.apache.org/struts/browse/WW-2511)
>
> I'm going to remove the hardcoded OGNL expressions from UIBean and Label
> and replace them with the same algorithm used by Text. I would have
> proceeded without saying so but I also discovered that the TestAction used
> by the unit tests relies on getText being invoked directly by OGNL rather
> than its TextProvider implementation, so the consequences may be larger that
> I first imagined.
>
> Please speak up if you see any potential issues.
>
> regards,
> Jeromy Evans
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org