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

NullPointerException occurs when using an EL Expression in f:viewParam name attribute

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.15
    • 2.0.16, 2.1.10
    • JSR-314
    • None
    • WebSphere Application Server 8.0 using MyFaces 2.0.15

    Description

      When using a f:viewParm on a page and using an EL Expression in the name attribute of the f:viewParm the following NullPointerException occurs:

      java.lang.NullPointerException
      at org.apache.myfaces.util.AbstractAttributeMap.get(AbstractAttributeMap.java:94)
      at javax.faces.component.UIViewParameter.decode(UIViewParameter.java:84)
      at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1377)
      at javax.faces.component.UIInput.processDecodes(UIInput.java:188)
      at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1371)
      at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1365)
      at javax.faces.component.UIViewRoot._processDecodesDefault(UIViewRoot.java:1406)
      at javax.faces.component.UIViewRoot.access$400(UIViewRoot.java:74)
      at javax.faces.component.UIViewRoot$ApplyRequestValuesPhaseProcessor.process(UIViewRoot.java:1497)
      at javax.faces.component.UIViewRoot._process(UIViewRoot.java:1372)
      at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:759)
      at org.apache.myfaces.lifecycle.ApplyRequestValuesExecutor.execute(ApplyRequestValuesExecutor.java:38)
      at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:171)
      at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)

      For example the following will work:

      <f:viewParam name="firstName" value="#

      {userBean.user.firstName}" />

      but this would fail:

      <f:viewParam name="#{userBean.paramName1}" value="#{userBean.user.firstName}

      " />

      I'm willing to code up a fix for this issue, but I need a bit of help figuring out where the fix needs to go. It seems the EL expression works fine in the value attribute just not in the name attribute. However according to the JavaDocs name can be an EL Expression.

      Attachments

        1. UIViewParameter.patch
          0.7 kB
          Paul Nicolucci

        Activity

          People

            lu4242 Leonardo Uribe
            paul.nicolucci Paul Nicolucci
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 8h
                8h
                Remaining:
                Remaining Estimate - 8h
                8h
                Logged:
                Time Spent - Not Specified
                Not Specified