[ 
https://issues.apache.org/jira/browse/MYFACES-4585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17697039#comment-17697039
 ] 

Thomas Andraschko edited comment on MYFACES-4585 at 3/6/23 4:54 PM:
--------------------------------------------------------------------

TBH checking that issue would cost me some hours, not sure if i will invest 
this.
When AutoComplete#getItemLabel is called, #{converter} resolves to null, thats 
the problem.
Just put a breakpoint there and watch 
"jakarta.faces.context.FacesContext.getCurrentInstance().getApplication().evaluateExpressionGet(jakarta.faces.context.FacesContext.getCurrentInstance(),
 "#{converter}", Object.class)"

it seems to work fine when you remove in components/panel.xhtml the tst:panel 
wrapper.

Seems the whole expression is lost, not just the type.
If you can debug further, i can assist.




was (Author: tandraschko):
TBH checking that issue would cost me some hours, not sure if i will invest 
this.
When AutoComplete#getItemLabel is called, #{converter} resolves to null, thats 
the problem.
Just put a breakpoint there and watch 
"jakarta.faces.context.FacesContext.getCurrentInstance().getApplication().evaluateExpressionGet(jakarta.faces.context.FacesContext.getCurrentInstance(),
 "#{converter}", Object.class)"

it seems to work fine when you remove in components/panel.xhtml the tst:panel 
wrapper.

Seems the whole expression is lost, now just the type.
If you can debug further, i can assist.



> 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
>            Priority: Major
>         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