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

NullPointerException in FaceletStateValueExpression when ViewPooling enabled

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.2.7
    • 2.2.9
    • General
    • None

    Description

      There's a NullPointerException in FaceletStateValueExpression.getValue() when using ViewPooling under a specific scenario. Its triggered during an AJAX post-back when we provide a CDI bean as a ui:param into a ui:include via an EL lookup. This pattern works correctly when view pooling is disabled.

      Here's a example snippet of what triggers the issue.

      Snippet from the main page:

      <ui:include src="includedAjax.xhtml">
      <ui:param name="controller" value="#

      {helloCdiTwoViewScopedBean}

      "/>
      </ui:include>

      The component referenced from the <ui:include>:

      <h:form id="jsfcdiviewViewScoped">
      <h:inputText id="name" value="#

      {controller.name}

      "></h:inputText>
      <h:commandButton value="Welcome Me">
      <f:ajax execute="@form" render="output"/>
      </h:commandButton>

      <h2><h:outputText id="output" value="#

      {controller.sayWelcome}

      " /></h2>
      view:#

      {view}

      viewScope:#

      {viewScope}

      </h:form>

      The NullPointerException stack trace is listed below. A simple example to recreate will also be attached.

      2015-04-06 15:30:11,812 DEBUG [com.autotrader.enterprise.common.context.LogPhaseListener] (default task-4) Start Phase RESTORE_VIEW(1)
      2015-04-06 15:30:11,818 DEBUG [com.autotrader.enterprise.common.context.LogPhaseListener] (default task-4) End Phase RESTORE_VIEW(1)
      2015-04-06 15:30:11,818 DEBUG [com.autotrader.enterprise.common.context.LogPhaseListener] (default task-4) Start Phase APPLY_REQUEST_VALUES(2)
      2015-04-06 15:30:11,822 DEBUG [com.autotrader.enterprise.common.context.LogPhaseListener] (default task-4) End Phase APPLY_REQUEST_VALUES(2)
      2015-04-06 15:30:11,822 DEBUG [com.autotrader.enterprise.common.context.LogPhaseListener] (default task-4) Start Phase PROCESS_VALIDATIONS(3)
      2015-04-06 15:30:11,824 DEBUG [com.autotrader.enterprise.common.context.LogPhaseListener] (default task-4) End Phase PROCESS_VALIDATIONS(3)
      2015-04-06 15:30:11,826 ERROR [com.autotrader.enterprise.common.exception.AtExceptionHandler] (default task-4) Error occurred on page: http://taxi49003.autotrader.com:8400/examples/ajaxsamples/helloAjaxInclude.xhtml for ip address: 10.102.113.33 and sessionid: vlQO1yZzubh1-z23UF9S7YUz: java.lang.NullPointerException
      at org.apache.myfaces.view.facelets.el.FaceletStateValueExpression.getValue(FaceletStateValueExpression.java:107) [myfaces-impl-2.2.7.jar:2.2.7]
      at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:112) [javax.el-3.0.1-b05.jar:]
      at com.sun.el.parser.AstValue.getBase(AstValue.java:151) [javax.el-3.0.1-b05.jar:]
      at com.sun.el.parser.AstValue.getTarget(AstValue.java:170) [javax.el-3.0.1-b05.jar:]
      at com.sun.el.parser.AstValue.getType(AstValue.java:86) [javax.el-3.0.1-b05.jar:]
      at com.sun.el.ValueExpressionImpl.getType(ValueExpressionImpl.java:201) [javax.el-3.0.1-b05.jar:]
      at org.jboss.weld.el.WeldValueExpression.getType(WeldValueExpression.java:93) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]
      at org.jboss.weld.el.WeldValueExpression.getType(WeldValueExpression.java:93) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]
      at org.apache.myfaces.view.facelets.el.ContextAwareTagValueExpression.getType(ContextAwareTagValueExpression.java:75) [myfaces-impl-2.2.7.jar:2.2.7]
      at org.apache.myfaces.shared.renderkit._SharedRendererUtils.findUIOutputConverter(_SharedRendererUtils.java:78) [myfaces-impl-2.2.7.jar:2.2.7]
      at org.apache.myfaces.shared.renderkit.RendererUtils.findUIOutputConverter(RendererUtils.java:543) [myfaces-impl-2.2.7.jar:2.2.7]
      at org.apache.myfaces.shared.renderkit.RendererUtils.getConvertedUIOutputValue(RendererUtils.java:1004) [myfaces-impl-2.2.7.jar:2.2.7]
      at org.apache.myfaces.shared.renderkit.html.HtmlTextRendererBase.getConvertedValue(HtmlTextRendererBase.java:356) [myfaces-impl-2.2.7.jar:2.2.7]
      at javax.faces.component.UIInput.getConvertedValue(UIInput.java:662) [myfaces-api-2.2.7.jar:2.2.7]
      at javax.faces.component.UIInput.validate(UIInput.java:598) [myfaces-api-2.2.7.jar:2.2.7]
      at javax.faces.component.UIInput.processValidators(UIInput.java:274) [myfaces-api-2.2.7.jar:2.2.7]
      at javax.faces.component.UIForm.processValidators(UIForm.java:210) [myfaces-api-2.2.7.jar:2.2.7]
      at org.apache.myfaces.context.servlet.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:776) [myfaces-impl-2.2.7.jar:2.2.7]
      at org.apache.myfaces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:213) [myfaces-impl-2.2.7.jar:2.2.7]
      at javax.faces.component.UIForm.visitTree(UIForm.java:314) [myfaces-api-2.2.7.jar:2.2.7]

      Attachments

        1. DefaultFaceletsStateManagementStrategy.java
          72 kB
          Leonardo Uribe
        2. helloAjaxInclude.xhtml
          0.5 kB
          Chris Kulinski
        3. includedAjax.xhtml
          0.6 kB
          Chris Kulinski
        4. MYFACES-3978-1.patch
          5 kB
          Leonardo Uribe

        Activity

          People

            lu4242 Leonardo Uribe
            kulinski Chris Kulinski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: