Hi

I have been thinking about this report:

https://issues.apache.org/jira/browse/MYFACES-3613

NPE in composite component when ActionListener is missing in the source

        <cc:interface>
                <cc:attribute name="action"/>
                <cc:attribute name="actionListener"/>
        <cc:attribute name="value"/>
        </cc:interface>
        <cc:implementation>             
                <h:commandButton value="#{cc.attrs.value}"
action="#{cc.attrs.action}"
actionListener="#{cc.attrs.actionListener}" immediate="true">
                        <cc:insertChildren/>
                </h:commandButton>
        </cc:implementation>

Right now, MyFaces just throw an exception when the attributes are not set
in the composite component, but doesn't sound more reasonable avoid the
exception and act like nothing happened?

In practice h:commandButton will have a dummy listener and an action attached,
but that's the same as if both attributes were empty. I can't imagine any side
effect, and it is a common case when you are using composite components.

regards,

Leonardo Uribe

Reply via email to