Manuel K created MYFACES-4585:
---------------------------------

             Summary: EL expression error: MethodNotFoundException due to wrong 
type
                 Key: MYFACES-4585
                 URL: https://issues.apache.org/jira/browse/MYFACES-4585
             Project: MyFaces Core
          Issue Type: Bug
          Components: General
    Affects Versions: 4.0.0
         Environment: primefaces-test project, jakarta branch
            Reporter: Manuel K
         Attachments: image-2023-03-06-13-26-43-151.png

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{_}:
{code:java}
<?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>
{code}
The method call somehow assumes a String, so the following exception is thrown:
{code:java}
jakarta.el.MethodNotFoundException: Method not found: class 
java.lang.String.getDisplayValue(java.lang.String) {code}
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:

!image-2023-03-06-13-26-43-151.png!

It works using 
{code:java}
mvn clean jetty:run -Pmojarra40{code}
 but not using 
{code:java}
mvn clean jetty:run -Pmyfaces40{code}
Thank you very much in advance for taking a look!



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to