Hi Gerhard,

a demo is available as war-file:
http://www.humyo.de/10453303/TestProject.war?a=fojK9Jp2984. Just follow the
links, enter a value and press the button. 

In org.apache.myfaces.extensions.validator.core.el.ExtValELResolver:

    public ValueExpression getCompositeComponentExpression()
    {
        if(this.compositeComponentExpressionHolder != null)
        {
            return
this.compositeComponentExpressionHolder.getExpression(this.compositeComponen
tExpressionBase);
        }
        return null;
    }

this.compositeComponentExpressionBase is null which leads into the NPE.


Thanks for taking a look insight.

Tom




> -----Ursprüngliche Nachricht-----
> Von: Gerhard Petracek [mailto:[email protected]]
> Gesendet: Dienstag, 29. Juni 2010 15:44
> An: MyFaces Discussion
> Betreff: Re: ExtVal: NullPointer during EL resolving for custom
> component
> 
> hi tom,
> 
> we have to check if it is an issue of the jsf impl. you are using.
> the todo was placed there, because there were some changes in the jsf
> implementations.
> 
> it would be nice if you can provide a link to a small demo app which
> illustrates the issue.
> (-> not everybody of the community who would like to debug the issue
> has to
> create the demo app.)
> 
> regards,
> gerhard
> 
> http://www.irian.at
> 
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
> 
> Professional Support for Apache MyFaces
> 
> 
> 
> 2010/6/29 <[email protected]>
> 
> > Hi,
> >
> > the following NPE occured using Myfaces ExtVal:
> >
> > java.lang.NullPointerException
> >        at
> >
> javax.faces.component.UIComponent.getValueExpression(UIComponent.java:3
> 38)
> >        at
> >
> com.sun.faces.el.CompositeComponentAttributesELResolver$ExpressionEvalM
> ap.getExpression(CompositeComponentAttributesELResolver.java:314)
> >        at
> >
> org.apache.myfaces.extensions.validator.core.el.ExtValELResolver.getCom
> positeComponentExpression(ExtValELResolver.java:277)
> >        at
> >
> org.apache.myfaces.extensions.validator.core.el.DefaultELHelper.getProp
> ertyDetailsOfValueBinding(DefaultELHelper.java:169)
> >        at
> >
> org.apache.myfaces.extensions.validator.core.metadata.extractor.Default
> ComponentMetaDataExtractor.extract(DefaultComponentMetaDataExtractor.ja
> va:77)
> >        at
> >
> org.apache.myfaces.extensions.validator.core.interceptor.AbstractValida
> tionInterceptor.getPropertyInformation(AbstractValidationInterceptor.ja
> va:176)
> >        at
> >
> org.apache.myfaces.extensions.validator.core.interceptor.AbstractValida
> tionInterceptor.processAfterValidation(AbstractValidationInterceptor.ja
> va:166)
> >        at
> >
> org.apache.myfaces.extensions.validator.core.interceptor.AbstractValida
> tionInterceptor.beforeGetConvertedValue(AbstractValidationInterceptor.j
> ava:153)
> >        at
> >
> org.apache.myfaces.extensions.validator.core.renderkit.ExtValRendererWr
> apper.getConvertedValue(ExtValRendererWrapper.java:369)
> >        at
> > javax.faces.component.UIInput.getConvertedValue(UIInput.java:1008)
> >        at javax.faces.component.UIInput.validate(UIInput.java:934)
> >        at
> javax.faces.component.UIInput.executeValidate(UIInput.java:1189)
> >        at
> javax.faces.component.UIInput.processValidators(UIInput.java:691)
> >        at
> >
> javax.faces.component.UIComponentBase.processValidators(UIComponentBase
> .java:1080)
> >        at
> >
> javax.faces.component.UIComponentBase.processValidators(UIComponentBase
> .java:1080)
> >        at
> javax.faces.component.UIForm.processValidators(UIForm.java:243)
> >        at
> >
> javax.faces.component.UIComponentBase.processValidators(UIComponentBase
> .java:1080)
> >        at
> >
> javax.faces.component.UIComponentBase.processValidators(UIComponentBase
> .java:1080)
> >        at
> >
> javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1180
> )
> >        at
> >
> com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidati
> onsPhase.java:76)
> >        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
> >        at
> > com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
> >        at
> javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
> >
> >
> > I used the following code:
> >
> > Page:
> >
> >          <ui:composition
> > template="/resources/templates/test-template.xhtml">
> >
> >                <ui:define name="test-workspace">
> >
> >                        <ui:remove>
> >                                a) works <parts-test:nestedCC
> > myValue="#{personBean.person}"/>
> >                                b) works <parts-test:nestedCC
> > myValue="#{personBean.person.adresse}"/>
> >                        </ui:remove>
> >
> >                        c) NPE!!! <parts-test:nestedCC
> > myValue="#{personBean.person.adresse.plz}"/>
> >
> >                </ui:define>
> >
> >        </ui:composition>
> >
> > CustomComponent:
> >
> >        <composite:interface>
> >                <composite:attribute name="myValue" required="true" />
> >        </composite:interface>
> >
> >       <composite:implementation>
> >
> >                <ui:remove>
> >                        a) works <h:inputText id="theValue"
> > value="#{cc.attrs.myValue.adresse.plz}" />
> >                        b) works <h:inputText id="theValue"
> > value="#{cc.attrs.myValue.plz}" />
> >                </ui:remove>
> >
> >                    c) NPE!!! <h:inputText id="theValue"
> > value="#{cc.attrs.myValue}" />
> >
> >        </composite:implementation>
> >
> > The code behind the scenes is:
> > - a managed bean "PersonBean"
> > - ...which refers to an object "Person" which refers to an object
> "Adresse"
> > which has a string property "plz"
> > - for testing purposes I implemented some get/setPlz in PersonBean
> and
> > Person too which provide the value stored in Adresse.plz
> >
> > In case c), using a deeply nested EL expression, the NPE occurs.
> >
> > In the ExtVal code I found in
> >
> org.apache.myfaces.extensions.validator.core.el.DefaultELHelper.getProp
> ertyDetailsOfValueBinding(UIComponent):
> >
> > @ToDo(value = Priority.HIGH, description = "check if it works with
> nested
> > composite components")
> >
> > Is this TODO still an open one or is the EL expression revealing a
> new bug?
> >
> > --
> > WM 2010: Top News, Spielpläne, Public Viewing-Termine, E-Cards und
> alles,
> > was der Fan sonst noch braucht, gibt´s im Sport-Channel auf arcor.de.
> > http://www.arcor.de/rd/footer.wm2010
> >

Reply via email to