ICEmobile
  1. ICEmobile
  2. MOBI-470

ContentStackMenu NullPointerException when the ContentStack id cannot be found

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.1 Final
    • Fix Version/s: EE 1.2
    • Component/s: Faces
    • Labels:
      None
    • Environment:
      n/a

      Description


      If the associated contentStack of a contentStackMenu is in a separate form the following NullPointerException results:

      java.lang.NullPointerException
      at javax.faces.component.UIComponentBase.findComponent(UIComponentBase.java:561)
      at org.icefaces.mobi.component.contentmenuitem.ContentMenuItemRenderer.renderItemAsList(ContentMenuItemRenderer.java:193)
      at org.icefaces.mobi.component.contentmenuitem.ContentMenuItemRenderer.encodeEnd(ContentMenuItemRenderer.java:86)
      at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
      at org.icefaces.mobi.renderkit.BaseLayoutRenderer.renderChild(BaseLayoutRenderer.java:52)
      at org.icefaces.mobi.renderkit.BaseLayoutRenderer.renderChildren(BaseLayoutRenderer.java:38)
      at org.icefaces.mobi.component.contentstackmenu.ContentStackMenuRenderer.encodeBegin(ContentStackMenuRenderer.java:123)
      at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:820)
      at javax.faces.component.UIData.encodeBegin(UIData.java:1118)
      at org.icefaces.impl.component.UISeriesBase.encodeBegin(UISeriesBase.java:502)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1755)
      at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
      at org.icefaces.impl.renderkit.RendererWrapper.encodeChildren(RendererWrapper.java:49)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)
      at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:402)
      at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
      ...


        Activity

        Hide
        Judy Guglielmin added a comment -

        there are limitations in findComponent in JSF. If the component is within another naming container (like a form), then the id of the content stack will have to reflect that ....(too bad there wasn't some markup here already here for intended use, but will assume the following):_
        <h:form id="form1">
        <mobi:contentStackMenu contentStackId="form2:stack2".....>
        ......
        <mobi:contentStackMenu>
        </h:form>

        <h:form id="form2">
        <contentStack id="stack2"....>
        .....
        </contentStack>
        </h:form>

        ======
        has this been attempted in the sample that threw this exception? This is the approach that ace favors when limitations on findComponent arise.

        Show
        Judy Guglielmin added a comment - there are limitations in findComponent in JSF. If the component is within another naming container (like a form), then the id of the content stack will have to reflect that ....(too bad there wasn't some markup here already here for intended use, but will assume the following):_ <h:form id="form1"> <mobi:contentStackMenu contentStackId="form2:stack2".....> ...... <mobi:contentStackMenu> </h:form> <h:form id="form2"> <contentStack id="stack2"....> ..... </contentStack> </h:form> ====== has this been attempted in the sample that threw this exception? This is the approach that ace favors when limitations on findComponent arise.
        Hide
        Philip Breau added a comment -

        That's beside the point. We shouldn't be running into an NPE in the first place. Check for null before proceeding.

        Show
        Philip Breau added a comment - That's beside the point. We shouldn't be running into an NPE in the first place. Check for null before proceeding.
        Hide
        Judy Guglielmin added a comment -

        good point
        thought i had but obviously need more tests for various use-cases. Only been testing for what appeared (to me) most common use-cases, and no-one else has added any further ones.

        Show
        Judy Guglielmin added a comment - good point thought i had but obviously need more tests for various use-cases. Only been testing for what appeared (to me) most common use-cases, and no-one else has added any further ones.
        Hide
        Judy Guglielmin added a comment -

        rev 32860

        Show
        Judy Guglielmin added a comment - rev 32860

          People

          • Assignee:
            Judy Guglielmin
            Reporter:
            Philip Breau
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: