title: passing method parameter to nested composite component fails
body: <p>I have a problem with passing method parameters to nested composite component.</p>
  
  <p>I have a first component wose composite:interface looks like :</p>
  
  <pre><code>&lt;composite:interface&gt;
      &lt;composite:attribute name="onRowEditListener" required="false" method-signature="void listener(org.primefaces.event.RowEditEvent)"/&gt;
  &lt;/composite:interface&gt;
  </code></pre>
  
  <p>It uses another composite component component which has a similar interface.</p>
  
  <p>The first level component is used this way :</p>
  
  <pre><code>&lt;mynamespace:compo1 onRowEditListener=#{bean.method}"/&gt;
  </code></pre>
  
  <p>The nested one is used this way :</p>
  
  <pre><code>&lt;mynamespace:compo2 onRowEditListener=#{cc.attrs.onRowEditListener}"/&gt;
  </code></pre>
  
  <p>If I insert  in both controls, I got :</p>
  
  <ul>
  <li>in the first level control, an output like org.apache.el.MethodExpressionImpl@358f0647, which looks good to me</li>
  <li>in the second (nested) level control, an output like org.apache.myfaces.view.facelets.el.LocationValueExpression@ff381f45 .</li>
  </ul>
  
  <p>Raised exception looks like :</p>
  
  <pre><code>19/07/2012 19:39:02 fr.senat.faces.exceptions.DetailedExceptionHandler INFO  [DetailedExceptionHandler.java:40] [http-8080-7] - Stack trace: javax.faces.FacesException: Exception while calling broadcast on component : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /editSenateur.xhtml][Class: javax.faces.component.html.HtmlBody,Id: j_id_5][Class: org.primefaces.component.layout.Layout,Id: j_id_6][Class: org.primefaces.component.layout.LayoutUnit,Id: j_id_v][Class: org.primefaces.component.outputpanel.OutputPanel,Id: detailCommissions][Class: javax.faces.component.html.HtmlForm,Id: j_id_x][Class: org.primefaces.component.tabview.TabView,Id: tabFonctionsInternes][Class: org.primefaces.component.tabview.Tab,Id: fonctionsCommissions][Class: javax.faces.component.UINamingContainer,Id: j_id_10][Class: javax.faces.component.UIPanel,Id: j_idj_id_10__f_cc_facet][Class: org.primefaces.component.outputpanel.OutputPanel,Id: panelTabViewCommissions][Class: org.primefaces.component.tabview.TabView,Id: tabViewCommissions][Class: org.primefaces.component.tabview.Tab,Id: commissionTab][Class: org.primefaces.component.panelgrid.PanelGrid,Id: j_id_15][Class: org.primefaces.component.row.Row,Id: j_id_1b][Class: org.primefaces.component.column.Column,Id: j_id_1c][Class: javax.faces.component.UINamingContainer,Id: j_id_1d][Class: javax.faces.component.UIPanel,Id: j_idj_id_1d__f_cc_facet][Class: org.primefaces.component.datatable.DataTable,Id: sheetFonctions]} created from: /resources/sen/fonctionsCommission.xhtml at line 27 and column 162
      at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:430)
      at javax.faces.component.UIData.broadcast(UIData.java:1610)
      at javax.faces.component.UIData.broadcast(UIData.java:1596)
      at javax.faces.component.UIData.broadcast(UIData.java:1596)
      at javax.faces.component.UIData.broadcast(UIData.java:1596)
      at javax.faces.component.UIViewRoot._broadcastAll(UIViewRoot.java:1023)
      at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:286)
      at javax.faces.component.UIViewRoot._process(UIViewRoot.java:1360)
      at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
      at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:38)
      at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:170)
      at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
      at org.apache.myfaces.extensions.cdi.jsf2.impl.listener.phase.CodiLifecycleWrapper.execute(CodiLifecycleWrapper.java:95)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:357)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at fr.senat.faces.filters.HibernateSessionConversationFilter.doFilter(HibernateSessionConversationFilter.java:76)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
      at java.lang.Thread.run(Thread.java:662)
  Caused by: org.apache.myfaces.view.facelets.el.ContextAwareELException: javax.el.ELException: java.lang.IllegalArgumentException: wrong number of arguments
      at org.apache.myfaces.view.facelets.el.ContextAwareTagMethodExpression.invoke(ContextAwareTagMethodExpression.java:108)
      at org.primefaces.component.behavior.ajax.AjaxBehaviorListenerImpl.processAjaxBehavior(AjaxBehaviorListenerImpl.java:42)
      at org.primefaces.event.RowEditEvent.processListener(RowEditEvent.java:41)
      at javax.faces.component.behavior.BehaviorBase.broadcast(BehaviorBase.java:74)
      at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:406)
      ... 31 more
  Caused by: javax.el.ELException: java.lang.IllegalArgumentException: wrong number of arguments
      at org.apache.el.parser.AstValue.invoke(AstValue.java:195)
      at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
      at org.apache.myfaces.view.facelets.el.ValueExpressionMethodExpression.invoke(ValueExpressionMethodExpression.java:68)
      at org.apache.myfaces.view.facelets.el.ContextAwareTagMethodExpression.invoke(ContextAwareTagMethodExpression.java:96)
      ... 35 more
  Caused by: java.lang.IllegalArgumentException: wrong number of arguments
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.apache.el.parser.AstValue.invoke(AstValue.java:191)
      ... 38 more
  </code></pre>
  
  <p>It looks like the method is properly passed to the first control, but that the EL expression gets a bullet when passed to the second...</p>
  
  <p>I am using :</p>
  
  <ul>
  <li>MyFaces 2.1.7</li>
  <li>Tomcat 6.0.33</li>
  </ul>
  
  <p>Thanks in advance for your help.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>The only "progress" I can assess is a kludge...</p>
  
  <p>The kludge class :</p>
  
  <pre><code>/**
   * 
   * @author lpenet
   * 
   *         This class is a workaround kluge. Methods passed as a parameter to a
   *         composite component then to a PrimeFaces p:ajax seems to get a bullet
   *         somewhere in the process, at least with Tomcat 6 + MyFaces
   *         2.1 + CODI 1.0.5 + OpenWebbeans 1.0.3 See :
   *         http://forum.primefaces.org/viewtopic.php?f=3&amp;t=23558&amp;p=72885#p72885
   * 
   *         Using this class as "componentType", one can forward the methode call.
   *
   *         Not so nice, but... works.
   * 
   */
  @FacesComponent(value = "fr.senat.beans.PrimefacesListenerKludge")
  public class PrimefacesListenerKludge extends UINamingContainer {
  
      @Override
      public String getFamily() {
          return "javax.faces.NamingContainer"; // Important! Required for
                                                  // composite components.
      }
  
      public void forwardRowEditListener(RowEditEvent event) {
          FacesContext context = FacesContext.getCurrentInstance();
          Object listener = getAttributes().get("onRowEditListener");
          if (listener == null) {
              return;
          }
          MethodExpression ajaxEventListener = (MethodExpression) listener;
          ajaxEventListener
                  .invoke(context.getELContext(), new Object[] { event });
      }
  }
  </code></pre>
  
  <p>Sample use :</p>
  
  <pre><code>&lt;composite:interface componentType="fr.senat.beans.PrimefacesListenerKludge"&gt;
          ...
      &lt;composite:attribute name="onRowEditListener" required="false"
          method-signature="void listener(org.primefaces.event.RowEditEvent)"
          default="#{cc.parent.attrs.onRowEditListener}" /&gt;
  &lt;/composite:interface&gt;
  &lt;composite:implementation&gt;
          ...
      &lt;/composite:implementation&gt;
  </code></pre>
  
  <p>To be honest, I do not know if it is still required with my current stack (PrimeFaces 4/MyFaces 2.1.13/OWB 1.2.1/Tomcat 7.0.32) but lacks the time to test.</p>