(... hope this mail works (yesterday I have had problems with the mailing list ...)

I've found some problems with the _ComponentAttributesMap in MyFaces.
I've discussed this problem with Matthias Wesseldorf and Martin Marinscheck.
Martin has committed this change to the SVN.

Regards,

Udo

-- snip -- The mail I wrote yesterday but never has been delivered:

The problem applies to 3.1.4 and 3.1.10 of the JSF-Spec 1.1.
There is a different behaviour of the "get" method of the AttributeMap
of UIComponent between Suns RI and the MyFaces-Impl.

I found something related to my problem in the archive:

1. http://issues.apache.org/jira/browse/MYFACES-74
2. http://www.mail-archive.com/[email protected]/msg00293.html

In the mail thread Ed Burns suggests the following steps:
1 If there is a javaBeans getter for the property,
return the result of calling it.

2 If there is an actual attribute for that name,
return it.

3 If there is a valueBinding for that name, return the
result of doing a get on it.

The bugfix of MYFACES-74 does these steps:
1. Checks for a property of the given name.
  1.1 returns the property's value if not null
  1.2. Checks for a ValueBinding of the given name.
    1.2.1 returns the ValueBinding's value or null if there is no
          ValueBinding
2. Performs the normal Map.get(Object) operation.

Ed Burns also says that step 3 is important and should be put in an
errata of 1.1.

There was also a discussion of redundant calls of ValueBinding.
The problem I see is that in step 1.2.1 the ValueBinding's value is
always null, because if it would be not null this value has already been
returned in step 1.1 (specification of getters of UIComponents).

If the get function of javax.faces.component._ComponentAttributesMap
will be implemented like the suggestion of Ed Burns it might look like this:

public Object get(Object key)
{
    checkKey(key);
    PropertyDescriptor propertyDescriptor
        = getPropertyDescriptor((String)key);
    if (propertyDescriptor != null)
    {
        return getComponentProperty(propertyDescriptor);
    }
    Object mapValue = _attributes.get(key);
    if (mapValue != null)
    {
        return mapValue;
    }
    ValueBinding vb = _component.getValueBinding((String) key);
    if (vb != null)
    {
        return vb.getValue(FacesContext.getCurrentInstance());
    }
    return null;
}

The unit-test target and my stuff (Tobago) run with this implementation.

Regards

Udo



Reply via email to