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:

      <ui:composition
       xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core">
      
       <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="?" />
       </ui:fragment>
      
      </ui:composition>
      


      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.