[
http://issues.apache.org/jira/browse/MYFACES-520?page=comments#action_12322739
]
Peter Mahoney commented on MYFACES-520:
---------------------------------------
The following JSP causes the problem:
<f:view>
<h:form id="editform">
<h:inputText id="questionTitle" value="#{pollHandler.poll.title}"
required="true"/>
<h:message for="questionTitle"/>
<h:dataTable value="#{pollHandler.poll.questions}" var="question">
<h:column>
<h:outputText value="hello"/>
<f:verbatim><br/></f:verbatim>
<h:selectOneMenu id="questionType"
value="#{question.type}" required="true">
<f:selectItems
value="#{pollHandler.questionTypeItems}"/>
</h:selectOneMenu>
<h:inputText id="questionText"
value="#{question.text}"/>
</h:column>
</h:dataTable>
<h:commandButton/>
</h:form>
</f:view>
If the <f:verbatim> tag is removed, the problem goes away. If you need further
code, let me know. Thanks.
> NPE in UIData.restoreDescendantComponentStates()
> ------------------------------------------------
>
> Key: MYFACES-520
> URL: http://issues.apache.org/jira/browse/MYFACES-520
> Project: MyFaces
> Type: Bug
> Components: Implementation
> Versions: Nightly Build
> Reporter: Peter Mahoney
> Assignee: Mathias Broekelmann
>
> I have a form which contains some inputText fields (one of which is
> required), and a dataTable which contains an inputText field and a
> selectOneMenu field, plus and inner dataTable containing inputText fields.
> When a value is entered in the required inputText field, the form submits
> successfully. However, when the required field is left blank the following
> exception is thrown when processing the selectOneMenu field in the outer
> dataTable:
> java.lang.NullPointerException
> at
> javax.faces.component.UIData.restoreDescendantComponentStates(UIData.java:221)
> at
> javax.faces.component.UIData.restoreDescendantComponentStates(UIData.java:233)
> at
> javax.faces.component.UIData.restoreDescendantComponentStates(UIData.java:233)
> at
> javax.faces.component.UIData.restoreDescendantComponentStates(UIData.java:233)
> at javax.faces.component.UIData.setRowIndex(UIData.java:191)
> at
> org.apache.myfaces.renderkit.html.HtmlTableRendererBase.encodeInnerHtml(HtmlTableRendererBase.java:135)
> at
> org.apache.myfaces.renderkit.html.HtmlTableRendererBase.encodeChildren(HtmlTableRendererBase.java:94)
> at
> javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:319)
> at
> org.apache.myfaces.renderkit.RendererUtils.renderChild(RendererUtils.java:444)
> at
> org.apache.myfaces.renderkit.RendererUtils.renderChildren(RendererUtils.java:427)
> at
> org.apache.myfaces.renderkit.RendererUtils.renderChild(RendererUtils.java:448)
> at
> org.apache.myfaces.renderkit.RendererUtils.renderChildren(RendererUtils.java:427)
> at
> org.apache.myfaces.renderkit.RendererUtils.renderChild(RendererUtils.java:448)
> at
> org.apache.myfaces.renderkit.RendererUtils.renderChildren(RendererUtils.java:427)
> at
> org.apache.myfaces.renderkit.RendererUtils.renderChild(RendererUtils.java:448)
> at
> org.apache.myfaces.renderkit.RendererUtils.renderChildren(RendererUtils.java:427)
> at
> org.apache.myfaces.renderkit.RendererUtils.renderChild(RendererUtils.java:448)
> at
> org.apache.myfaces.renderkit.RendererUtils.renderChildren(RendererUtils.java:427)
> at
> org.apache.myfaces.renderkit.html.HtmlGroupRendererBase.encodeEnd(HtmlGroupRendererBase.java:62)
> at
> javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:331)
> at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:349)
> at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:253)
> at
> org.apache.myfaces.taglib.UIComponentBodyTagBase.doEndTag(UIComponentBodyTagBase.java:55)
> at
> org.apache.jsp.cppolls_jsp._jspx_meth_h_panelGroup_0(cppolls_jsp.java:297)
> at
> org.apache.jsp.cppolls_jsp._jspx_meth_f_subview_0(cppolls_jsp.java:255)
> at org.apache.jsp.cppolls_jsp._jspx_meth_f_view_0(cppolls_jsp.java:134)
> ...
> The following change to UIData seems to fix the problem:
> ...
> if (descendantStateIterator != null
> && descendantStateIterator.hasNext())
> {
> System.out.println("has dsi");
> Object[] object = (Object[]) descendantStateIterator.next();
> childState = object[0];
> descendantState = object[1];
> if (component instanceof EditableValueHolder && childState !=
> null)
> {
> ((EditableValueHolderState) childState)
> .restoreState((EditableValueHolder) component);
> }
> }
> ...
> However, should this patch be necessary, or is there a problem elsewhere?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira