[ https://issues.apache.org/jira/browse/MYFACES-3915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14121784#comment-14121784 ]
Leonardo Uribe commented on MYFACES-3915: ----------------------------------------- I have been trying to fix this one but I have realized that there is an easy way to fix it: {code:java} public class CustomComposite extends UINamingContainer { private UIInput field; /** getter and setters **/ {code} And then use #{cc.field} instead go into the attribute map. Also, even if we can overcome the bug reported here, the fix done in DeltaStateHelper will not be perfect, because from the beginning, a component binding should not be stored in the state, and that means it should not be stored on the attribute map. Fix it could lead to a bad syntax. The problem is in other cases, use the attribute map to hold components works as long as there is no state in the component, so it gives the wrong impression. After this reasoning I have to close this as won't fix, because the relationships between components should be coded in the component class. > NullpointerException during UIOuput state handling > -------------------------------------------------- > > Key: MYFACES-3915 > URL: https://issues.apache.org/jira/browse/MYFACES-3915 > Project: MyFaces Core > Issue Type: Bug > Affects Versions: 2.2.4 > Reporter: Sven Linstaedt > > Under the conditions: > * having a h:inputText in a composite component with binding to it's > composite component attribute map (like binding="#{cc.attrs.input}") > * attaching state holding converter (implements StateHolder) to the input > with non initial state > * having no other state saved (specifically UIOuput#saveState returns null) > a state array of size two is returned that looks like [null, converterState]. > Restoring this state causes UIOuput to hand over the first array entry to > UIOuput, which directly fails with a NPE, if the initialState was not marked. > {code} > java.lang.NullPointerException: state > at > javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:2046) > at javax.faces.component.UIOutput.restoreState(UIOutput.java:241) > at javax.faces.component.UIInput.restoreState(UIInput.java:1060) > at > javax.faces.component.UIComponentBase.restoreAttachedState(UIComponentBase.java:1915) > at > javax.faces.component._DeltaStateHelper$InternalMap.restoreState(_DeltaStateHelper.java:925) > at > javax.faces.component.UIComponentBase.restoreAttachedState(UIComponentBase.java:1915) > at > javax.faces.component._DeltaStateHelper.copyMap(_DeltaStateHelper.java:289) > at > javax.faces.component._DeltaStateHelper._createDeltas(_DeltaStateHelper.java:216) > at > javax.faces.component._DeltaStateHelper.put(_DeltaStateHelper.java:425) > at > javax.faces.component._ComponentAttributesMap.put(_ComponentAttributesMap.java:603) > at > javax.faces.component._ComponentAttributesMap.put(_ComponentAttributesMap.java:55) > at > org.apache.myfaces.el.unified.resolver.CompositeComponentELResolver$CompositeComponentAttributesMapWrapper.put(CompositeComponentELResolver.java:418) > at > org.apache.myfaces.el.unified.resolver.CompositeComponentELResolver$CompositeComponentAttributesMapWrapper.put(CompositeComponentELResolver.java:271) > at javax.el.MapELResolver.setValue(MapELResolver.java:94) > at javax.el.CompositeELResolver.setValue(CompositeELResolver.java:83) > at org.apache.el.parser.AstValue.setValue(AstValue.java:221) > at > org.apache.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:252) > at > org.jboss.weld.el.WeldValueExpression.setValue(WeldValueExpression.java:64) > at > org.apache.myfaces.view.facelets.el.ContextAwareTagValueExpression.setValue(ContextAwareTagValueExpression.java:153) > at > org.apache.myfaces.view.facelets.el.LocationValueExpression.setValue(LocationValueExpression.java:157) > at javax.faces.component.UIComponent.processEvent(UIComponent.java:849) > at > org.apache.myfaces.lifecycle.DefaultRestoreViewSupport$RestoreStateCallback.visit(DefaultRestoreViewSupport.java:281) > at > org.apache.myfaces.component.visit.FullVisitContext.invokeVisitCallback(FullVisitContext.java:141) > at javax.faces.component.UIComponent.visitTree(UIComponent.java:1016) > at > javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1191) > at javax.faces.component.UIComponent.visitTree(UIComponent.java:1044) > at > javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1191) > at javax.faces.component.UIComponent.visitTree(UIComponent.java:1044) > at > javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1191) > at javax.faces.component.UIComponent.visitTree(UIComponent.java:1044) > at > javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1191) > at > javax.faces.component.UINamingContainer.visitTree(UINamingContainer.java:177) > at javax.faces.component.UIComponent.visitTree(UIComponent.java:1044) > at > javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1191) > at javax.faces.component.UIComponent.visitTree(UIComponent.java:1032) > at > javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1191) > at > kn.gvs.framework.jsf.component.UIComposedInputComponent.visitTree(UIComposedInputComponent.java:337) > at javax.faces.component.UIComponent.visitTree(UIComponent.java:1044) > at > javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1191) > at javax.faces.component.UIComponent.visitTree(UIComponent.java:1044) > at > javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1191) > at javax.faces.component.UIForm.visitTree(UIForm.java:345) > at javax.faces.component.UIComponent.visitTree(UIComponent.java:1044) > at > javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1191) > at javax.faces.component.UIComponent.visitTree(UIComponent.java:1044) > at > javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1191) > at > org.apache.myfaces.lifecycle.DefaultRestoreViewSupport.processComponentBinding(DefaultRestoreViewSupport.java:144) > at > org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:202) > at > org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:196) > at > org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:143) > at > org.apache.deltaspike.jsf.impl.listener.request.DeltaSpikeLifecycleWrapper.execute(DeltaSpikeLifecycleWrapper.java:89) > at > javax.faces.lifecycle.LifecycleWrapper.execute(LifecycleWrapper.java:46) > at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) > at > org.jboss.weld.servlet.ConversationFilter.doFilter(ConversationFilter.java:70) > [...] > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)