[ 
https://issues.apache.org/jira/browse/CAMEL-25322?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-25322.
---------------------------------
    Fix Version/s: 4.23.0
       Resolution: Fixed

Fixed by https://github.com/apache/camel/pull/27334 (15f193253391).

> camel-bean - a missing Map key says the Map has no such key and lists its keys
> ------------------------------------------------------------------------------
>
>                 Key: CAMEL-25322
>                 URL: https://issues.apache.org/jira/browse/CAMEL-25322
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-bean
>            Reporter: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.23.0
>
>
> Since CAMEL-24916 a dot on a Map reads the key: {{$\{body.orderId\}}} gives 
> the value when the key is there. When the key is missing, the bean language 
> still adds the hint from before that change:
> {noformat}Failed to invoke method: orderId (the value is a Map: a key is read 
> with [orderId], as in ${body[orderId]}, not with .orderId) on the message 
> body of type java.util.LinkedHashMap ...{noformat}
> That points the wrong way: the dot form is fine, and {{$\{body[orderId]\}}} 
> would just give null. The actual mistake is that the Map has no such key, 
> typically because the body is not the Map one thinks: inside a split over an 
> order's lines the body is a line ({{sku, qty, price}}), not the order. Found 
> in the local-model benchmark (http-client and openapi-client), where the 
> model followed the hint and stayed stuck.
> *Proposal:* say what is true and show the keys: {{(the Map has no key 
> orderId; its keys are: sku, qty, price)}}, the key list capped (e.g. 20 keys).



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

Reply via email to