MyFaces Core
  1. MyFaces Core
  2. MYFACES-3413

Default MyFaces Error handling throws NullPointerException during component tree when javax.el.Expression.getExpressionString() is null

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1.3
    • Fix Version/s: 2.0.11, 2.1.5
    • Component/s: JSR-314
    • Labels:
      None

      Description

      The default MyFaces Error handling throws a NullPointerException during the writing out of the component tree when an attribute's ValueExpression.getExpressionString() returns null.

      As an example, this can happen with Richfaces 4.1.x skinning as the org.richfaces.application.GlobalResourcesViewHandler$SkinningResourceRenderedExpression
      used for "rendered" on the __rf_skinning_resource UIOutput has a null value for getExpressionString().

      From what I can tell, it's legal for Expression.getExpressionString() to return null.

      http://docs.oracle.com/javaee/5/api/javax/el/Expression.html#getExpressionString%28%29

      In any case, since this is an error handling routine, it should
      probably be more flexible in handling unexpected values.

      What do we want to do in this case?

      We could skip outputting the attribute.

      We could output the attribute with empty string as the value expression.

      In this particular case, we could check for isReadOnly() and if true, output getValue(). Not sure if we'd want to do that in the case of !isReadOnly(). In fact, I'm not entirely certain we want to be evaluating getValue().

      We could output the class of the value expression.

      As a first pass, I am going to output the value expression as the empty string.

        Activity

        Mike Kienenberger created issue -
        Hide
        Mike Kienenberger added a comment -

        Well, I wrote up a unit test and this isn't quite the problem I thought it was – there was a try{} catch

        { /* do nothing */ }

        later on that somewhat handles the situation.

        <UIOutput class="class javax.faces.component.UIOutput" clientId="_rf_skinning_resource" id="_rf_skinning_resource" inView="false" rendered=" transient="false"/> - State size:946 bytes

        Note that rendered=" is incomplete but still readable.

        Show
        Mike Kienenberger added a comment - Well, I wrote up a unit test and this isn't quite the problem I thought it was – there was a try{} catch { /* do nothing */ } later on that somewhat handles the situation. <UIOutput class="class javax.faces.component.UIOutput" clientId="_ rf_skinning_resource" id=" _rf_skinning_resource" inView="false" rendered=" transient="false"/> - State size:946 bytes Note that rendered=" is incomplete but still readable.
        Mike Kienenberger made changes -
        Field Original Value New Value
        Priority Major [ 3 ] Minor [ 4 ]
        Hide
        Mike Kienenberger added a comment -

        Leave value as empty string if no ExpressionString.

        Show
        Mike Kienenberger added a comment - Leave value as empty string if no ExpressionString.
        Mike Kienenberger made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.1.5-SNAPSHOT [ 12319075 ]
        Resolution Fixed [ 1 ]
        Mike Kienenberger made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Leonardo Uribe made changes -
        Fix Version/s 2.0.11 [ 12319078 ]
        Fix Version/s 2.1.5 [ 12319076 ]
        Fix Version/s 2.1.5-SNAPSHOT [ 12319075 ]

          People

          • Assignee:
            Mike Kienenberger
            Reporter:
            Mike Kienenberger
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development