javaserverfaces
  1. javaserverfaces
  2. JAVASERVERFACES-2780

PropertyNotFoundException thrown for actionListener

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Incomplete
    • Affects Version/s: 2.1.20
    • Fix Version/s: None
    • Component/s: composite components
    • Labels:
      None

      Description

      This Bug is propably based on http://java.net/jira/browse/JAVASERVERFACES-2729

      Testcase
      An CDI Bean of an arbitrary scope (e.g. javax.enterprise.context.RequestScoped) that has a void no-arg method which is used as an action listener for a composite component.

      import javax.enterprise.context.RequestScoped;
      import javax.inject.Named;
      
      @RequestScoped
      @Named
      public class TestBean {
          public void callActionListener() {
              System.out.println("ACTIONLISTENER CALLED");
          }	
      }
      
      menuActionItem.xhtml
      <cc:interface>
          <cc:attribute name="value" required="true" />
          <cc:attribute name="action" targets="view" required="true" />
          <cc:attribute name="actionListener" targets="menuLink" />
      </cc:interface>
      		
      <cc:implementation>
          <li><h:commandLink value="#{cc.attrs.value}" id="menuLink" /></li>
      </cc:implementation>
      
      index.jsf
      <!-- ... -->
      <m:menuActionItem value="Test" actionListener="#{testBean.callActionListener}" />
      <!-- ... -->
      

      Error
      com.sun.faces.facelets.el.ContextualCompositeMethodExpression is not able to resolve the EL expression to the callActionListener method of TestBean. It will throw an PropertyNonFoundExcpetion on line 208 (source is an instance of TagValueExpression) which is caught on line 214. The excpetion should be logged and the original EL exception is thrown on line 223 (well my JBoss 7 installation never reaches that point, as it throws itself an exception during the log() in line 216 when it tries to format [...]#

      {testBean.callActionListener}

      [...] using java.text.MessageFormat).

      More Details
      After I click on my link JSF tries to call my action listener two times. The first time with one argument ActionEvent which fails on line 186 and then again as described above (on line 186). The second time it is called without arguments and that call succeeds.

      The strange thing about that is, that it fails only once per application server (re)start (start -> click -> fail -> click -> ok -> click -> ok -> restart -> click -> fail ...)
      I think that something is wrong during the log() call in line 216 which triggers the fail of the logger itself. Maybe some missing resource? Could you please revisit it?

      (The same command link outside of the composite component works correct.)

      Dirty workaround for now
      If I change my index.jsf to

      index.jsf
      <!-- ... -->
      <m:menuActionItem value="Test" actionListener="#{testBean.callActionListener()}" />
      <!-- ... -->
      

      (notice the parentheses in the EL expression), everything works OK. But well, it is not elegant and not correct.

        Issue Links

          Activity

          Hide
          Manfred Riem added a comment -

          Closing because of inactivity

          Show
          Manfred Riem added a comment - Closing because of inactivity
          Hide
          Manfred Riem added a comment -

          Lowering priority because of no response

          Show
          Manfred Riem added a comment - Lowering priority because of no response
          Hide
          Manfred Riem added a comment -

          Lowering priority because of no response

          Show
          Manfred Riem added a comment - Lowering priority because of no response
          Hide
          Manfred Riem added a comment -

          Can you reproduce this on Glassfish?

          Show
          Manfred Riem added a comment - Can you reproduce this on Glassfish?

            People

            • Assignee:
              Unassigned
              Reporter:
              SteGr
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: