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

NullPointerException accessing an attribute of a component within c:forEach and partial state saving activated

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 2.2.10-SNAPSHOT
    • None
    • None
    • None

    Description

      Accessing an attribute from with in a composite component that is contained in a forEach tag causes a null pointer exception if partial state saving is enabled.

      As the example is too complex to be shown within this report an example project can be found at https://github.com/jgrimmwsb/faces-foreach-partial-state-saving.

      Steps to reproduce the error:

      1. Ensure the selected myfaces.version in the pom.xml is one of 2.2.10-SNAPSHOT.
      2. Ensure that javax.faces.PARTIAL_STATE_SAVING is set to true in the web.xml.
      3. Start the application and open the respective website.
      4. The log will show an exception like shown below:
      Stacktrace
      java.lang.NullPointerException
      	at org.apache.myfaces.view.facelets.el.FaceletStateValueExpression.getWrapped(FaceletStateValueExpression.java:75)
      	at org.apache.myfaces.view.facelets.el.FaceletStateValueExpression.getValue(FaceletStateValueExpression.java:107)
      	at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:74)
      	at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
      	at org.apache.myfaces.view.facelets.el.ContextAwareTagValueExpression.getValue(ContextAwareTagValueExpression.java:96)
      	at javax.faces.component._ComponentAttributesMap.get(_ComponentAttributesMap.java:331)
      	at example.Test.getVariables(Test.java:161)
      	at example.Test.captureOriginalVars(Test.java:133)
      	at example.Test.visitTree(Test.java:77)
      	at javax.faces.component.UIForm.visitTree(UIForm.java:345)
      	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1047)
      	at javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1191)
      

      With MyFaces 2.2.7 or Mojarra the error did not occur. MyFaces 2.2.10-SNAPSHOT with javax.faces.PARTIAL_STATE_SAVING is set to false works without error.

      Attachments

        Issue Links

          Activity

            People

              lu4242 Leonardo Uribe
              jgrimmwsb Johannes Grimm
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: