Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-4585

Facelets Compatibility: MethodNotFoundException due to wrong type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 4.0.0
    • None
    • General
    • None
    • primefaces-test project, jakarta branch

    Description

      When an object is passed through several layers of components, the type somehow gets lost and the expression evaluation uses the wrong type for a method call.

      Taglib component, where converter is of type java.faces.convert.Converter:

      <?xml version="1.0" encoding="UTF-8"?>
      
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                      xmlns:p="http://primefaces.org/ui"
                      xmlns:o="http://omnifaces.org/ui">
      
          <!--@elvariable id="value" type="java.lang.Object"-->
          <!--@elvariable id="converter" type="java.faces.convert.Converter"-->
          <!--@elvariable id="readonly" type="java.lang.Boolean"-->
          <!--@elvariable id="readonlyValue" type="java.lang.String"-->
      
          <o:tagAttribute name="value"
                          default=""/>
          <o:tagAttribute name="converter"
                          default=""/>
      
          <div>
              <p:autoComplete id="input"
                              value="#{value}"
                              var="item"
                              converter="#{converter}"
                              completeMethod="#{converter.suggest}"
                              itemValue="#{item}"
                              itemLabel="#{converter.getDisplayValue(item)}">
      
                  <ui:insert name="autoCompleteChildren"/>
      
              </p:autoComplete>
      
          </div>
      
      </ui:composition>
      

      The method call somehow assumes a String, so the following exception is thrown:

      jakarta.el.MethodNotFoundException: Method not found: class java.lang.String.getDisplayValue(java.lang.String) 

      I have created a reproducer here: https://github.com/mkomko/primefaces-test/tree/expression-error-method-not-found

      The AutoComplete component should work and render results as follows:

      It works using 

      mvn clean jetty:run -Pmojarra40

       but not using 

      mvn clean jetty:run -Pmyfaces40

      Thank you very much in advance for taking a look!

      Attachments

        Activity

          People

            Unassigned Unassigned
            mkomko Manuel K
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: