1 Reply Latest reply on Nov 11, 2006 2:41 PM by Stas Garifulin

    NPE in ParamMethodExpression

    Stas Garifulin Newbie

      I'm using facelets custom source file tags feature. Suppose i have tag "sortingColumnHeader" with source:

       <h:commandLink action="#{value.sort(name)}" value="#{title}" />
       <ui:fragment rendered="#{value.sortingColumn == name}">
       <h:outputText rendered="#{!value.inverseSorting}" value="?" />
       <h:outputText rendered="#{value.inverseSorting}" value="?" />

      Here i have variables which must be passed as arguments for the tag:

      <controls:sortingColumnHeader value="#{servers}" name="NAME" title="Server Name" />

      This causes NPE in MethodExpressionHelper.findParamTypes.

      I found solution: expression objects (ValueExpression, MethodExpression) for target object, method expression and call parameters (all this are used in different place in MethodExpressionHelper class) must be created with ELContext passed during creation of ParamMethodExpression because ELContext passed during MethodExpression.invoke does not contain mapping info between variable names used inside tag source file and actual values for the variables passed as tag attributes.

      Check com.sun.facelets.el.TagMethodExpression in facelets sources for example.