atom feed6 messages in org.apache.myfaces.usersExtVal: NullPointer during EL resolvi...
FromSent OnAttachments
myne...@arcor.deJun 29, 2010 6:14 am 
Gerhard PetracekJun 29, 2010 6:43 am 
Tom M.Jun 29, 2010 12:50 pm 
Leonardo UribeJun 29, 2010 11:21 pm 
myne...@arcor.deJun 29, 2010 11:28 pm 
Gerhard PetracekJun 29, 2010 11:45 pm 
Subject:ExtVal: NullPointer during EL resolving for custom component
From:myne...@arcor.de (myne@arcor.de)
Date:Jun 29, 2010 6:14:48 am
List:org.apache.myfaces.users

Hi,

the following NPE occured using Myfaces ExtVal:

java.lang.NullPointerException at javax.faces.component.UIComponent.getValueExpression(UIComponent.java:338) at
com.sun.faces.el.CompositeComponentAttributesELResolver$ExpressionEvalMap.getExpression(CompositeComponentAttributesELResolver.java:314) at
org.apache.myfaces.extensions.validator.core.el.ExtValELResolver.getCompositeComponentExpression(ExtValELResolver.java:277) at
org.apache.myfaces.extensions.validator.core.el.DefaultELHelper.getPropertyDetailsOfValueBinding(DefaultELHelper.java:169) at
org.apache.myfaces.extensions.validator.core.metadata.extractor.DefaultComponentMetaDataExtractor.extract(DefaultComponentMetaDataExtractor.java:77) at
org.apache.myfaces.extensions.validator.core.interceptor.AbstractValidationInterceptor.getPropertyInformation(AbstractValidationInterceptor.java:176) at
org.apache.myfaces.extensions.validator.core.interceptor.AbstractValidationInterceptor.processAfterValidation(AbstractValidationInterceptor.java:166) at
org.apache.myfaces.extensions.validator.core.interceptor.AbstractValidationInterceptor.beforeGetConvertedValue(AbstractValidationInterceptor.java:153) at
org.apache.myfaces.extensions.validator.core.renderkit.ExtValRendererWrapper.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(ProcessValidationsPhase.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.getPropertyDetailsOfValueBinding(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?