You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Martin Koci <Ma...@aura.cz> on 2007/05/18 00:48:25 UTC

[Trinidad] MessageFactory.BindingFacesMessage resolves parameters only once

Hi,

I probably found a problem  with BindingFacesMessage class. If calling
getMessage() it resolves value binding only once and then cache it. I
think values should be resolved every time as normal ValueBinding or
ValueExpressing does - calling getValue(context) creates a new value
every time; but BindingFacesMessage returns still same value (which can
be pretty old and unactual). 

How did I find the problem:

- in my converter I added logger - its logging converter message in
place where it occurs

- calling message.getSummary() resolves label of component to null,
because loadBundle is not loaded in process validation phase

- in message renderer: it call message.getSummary() too but it return
message with cached, null label. But there - in render response  phase -
label is null no more, because bundles loaded with f:loadBundle already
exist!


I fixed it locally with:
private void _resolveBindings()
    {
      //if (_resolvedParameters == null)
      //{
        _resolvedParameters = _getProcessedBindings(null, _parameters);
      //}
    }

What do you think?


Regards, 

Martin Koci








Re: [Trinidad] MessageFactory.BindingFacesMessage resolves parameters only once

Posted by Martin Koci <Ma...@aura.cz>.
https://issues.apache.org/jira/browse/TRINIDAD-28


Adam Winer píše v Pá 18. 05. 2007 v 10:55 -0700:
> Yeah, looks like a good fix.  I doubt the optimization of caching
> here is buying us much of anything.
> 
> -- Adam
> 
> 
> On 5/17/07, Martin Koci < Martin.Koci@aura.cz> wrote:
>         Hi,
>         
>         I probably found a problem  with BindingFacesMessage class. If
>         calling 
>         getMessage() it resolves value binding only once and then
>         cache it. I
>         think values should be resolved every time as normal
>         ValueBinding or
>         ValueExpressing does - calling getValue(context) creates a new
>         value
>         every time; but BindingFacesMessage returns still same value
>         (which can
>         be pretty old and unactual).
>         
>         How did I find the problem:
>         
>         - in my converter I added logger - its logging converter
>         message in
>         place where it occurs 
>         
>         - calling message.getSummary() resolves label of component to
>         null,
>         because loadBundle is not loaded in process validation phase
>         
>         - in message renderer: it call message.getSummary() too but it
>         return
>         message with cached, null label. But there - in render
>         response  phase - 
>         label is null no more, because bundles loaded with
>         f:loadBundle already
>         exist!
>         
>         
>         I fixed it locally with:
>         private void _resolveBindings()
>             {
>               //if (_resolvedParameters == null)
>               //{ 
>                 _resolvedParameters = _getProcessedBindings(null,
>         _parameters);
>               //}
>             }
>         
>         What do you think?
>         
>         
>         Regards,
>         
>         Martin Koci
>         
>         
>         
>         
>         
>         
>         
> 


Re: [Trinidad] MessageFactory.BindingFacesMessage resolves parameters only once

Posted by Adam Winer <aw...@gmail.com>.
Yeah, looks like a good fix.  I doubt the optimization of caching
here is buying us much of anything.

-- Adam


On 5/17/07, Martin Koci <Ma...@aura.cz> wrote:
>
> Hi,
>
> I probably found a problem  with BindingFacesMessage class. If calling
> getMessage() it resolves value binding only once and then cache it. I
> think values should be resolved every time as normal ValueBinding or
> ValueExpressing does - calling getValue(context) creates a new value
> every time; but BindingFacesMessage returns still same value (which can
> be pretty old and unactual).
>
> How did I find the problem:
>
> - in my converter I added logger - its logging converter message in
> place where it occurs
>
> - calling message.getSummary() resolves label of component to null,
> because loadBundle is not loaded in process validation phase
>
> - in message renderer: it call message.getSummary() too but it return
> message with cached, null label. But there - in render response  phase -
> label is null no more, because bundles loaded with f:loadBundle already
> exist!
>
>
> I fixed it locally with:
> private void _resolveBindings()
>     {
>       //if (_resolvedParameters == null)
>       //{
>         _resolvedParameters = _getProcessedBindings(null, _parameters);
>       //}
>     }
>
> What do you think?
>
>
> Regards,
>
> Martin Koci
>
>
>
>
>
>
>
>