atom feed6 messages in org.apache.myfaces.usersAw: Re: ExtVal: NullPointer during EL...
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:Aw: Re: ExtVal: NullPointer during EL resolving for custom component
From:myne...@arcor.de (myne@arcor.de)
Date:Jun 29, 2010 11:28:51 pm
List:org.apache.myfaces.users

Hi Gerhard, hi Leonardo,

Gerhard had already taken a look at this too.

JIRA-Issue: https://issues.apache.org/jira/browse/EXTVAL-102

Tom

----- Original Nachricht ---- Von: Leonardo Uribe <lu4@gmail.com> An: MyFaces Discussion <use@myfaces.apache.org> Datum: 30.06.2010 08:22 Betreff: Re: ExtVal: NullPointer during EL resolving for custom component

Hi

Thanks for the demo, it helps a lot. I tried th with myfaces and it throws the same exception:

javax.faces.FacesException: java.lang.NullPointerException: name can not be null at org.apache.myfaces.shared_impl.context.ExceptionHandlerImpl.wrap(ExceptionHa ndlerImpl.java:241)

at org.apache.myfaces.shared_impl.context.ExceptionHandlerImpl.handle(Exception HandlerImpl.java:156) at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:1 69) at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:96)

at javax.faces.webapp.FacesServlet.service(FacesServlet.java:189) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:206)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128 )

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102 ) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http 11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.NullPointerException: name can not be null at javax.faces.component.UIComponent.getValueExpression(UIComponent.java:543) at org.apache.myfaces.el.unified.resolver.CompositeComponentELResolver$Composit eComponentAttributesMapWrapper.getExpression(CompositeComponentELResolver.jav a:208)

at org.apache.myfaces.extensions.validator.core.el.ExtValELResolver.getComposit eComponentExpression(ExtValELResolver.java:277) at org.apache.myfaces.extensions.validator.core.el.DefaultELHelper.getPropertyD etailsOfValueBinding(DefaultELHelper.java:169)

at org.apache.myfaces.extensions.validator.core.metadata.extractor.DefaultCompo nentMetaDataExtractor.extract(DefaultComponentMetaDataExtractor.java:77) at org.apache.myfaces.extensions.validator.util.ExtValUtils$1.extract(ExtValUti ls.java:233)

at org.apache.myfaces.extensions.validator.core.interceptor.AbstractValidationI nterceptor.getPropertyInformation(AbstractValidationInterceptor.java:176) at org.apache.myfaces.extensions.validator.core.interceptor.AbstractValidationI nterceptor.processAfterValidation(AbstractValidationInterceptor.java:166)

at org.apache.myfaces.extensions.validator.core.interceptor.AbstractValidationI nterceptor.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:578) at javax.faces.component.UIInput.validate(UIInput.java:510) at javax.faces.component.UIInput.processValidators(UIInput.java:240) at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java :1218)

at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java :1218) at javax.faces.component.UIForm.processValidators(UIForm.java:137) at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java :1218)

at javax.faces.component.UIViewRoot._processValidatorsDefault(UIViewRoot.java:1 251) at javax.faces.component.UIViewRoot.access$500(UIViewRoot.java:77) at javax.faces.component.UIViewRoot$ProcessValidatorPhaseProcessor.process(UIVi ewRoot.java:1298)

at javax.faces.component.UIViewRoot._process(UIViewRoot.java:1207) at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:683) at org.apache.myfaces.lifecycle.ProcessValidationsExecutor.execute(ProcessValid ationsExecutor.java:34)

at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:1 49)

The problem resides in how CompositeComponentELResolver works. In few words, it returns a Map that points to composite component attributes, but this map is traversed by default MapELResolver, not the same CompositeComponentELResolver, so ExtValELResolver wrapper does not receive the control before evaluate and compositeComponentExpressionBase is never set.

The solution should be do something similar to the hack done in FlashELResolver. In that case, the resolver checks if the base is instanceof the map (in myfaces case CompositeComponentAttributesMapWrapper) and if so return the value as MapELResolver does (or in other words as FlashELResolver does).

I have not tested this solution yet but I think it will work. The behavior proposed is not described on jsf 2.0 spec section 5.6.2.2, but I think we can consider it an implementation detail and create a fix on myfaces. Please create an issue on myfaces issue tracker and I'll propose a patch for this one.

regards,