Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-520

NPE in UIData.restoreDescendantComponentStates()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.1.1
    • 1.1.1
    • General
    • None

    Description

      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?

      Attachments

        Activity

          People

            mbroekelmann Mathias Broekelmann
            pmahoney Peter Mahoney
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: