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

Claus Ibsen commented on CAMEL-26041:
-------------------------------------

PR [#28315|https://github.com/apache/camel/pull/28315]: when the failed method 
is one Camel does not call on a bean (equals, hashCode, wait and the other 
methods of java.lang.Object, except getClass, which BeanInfo invokes on its 
own), the error says so instead of the hint about the body, and for equals to 
compare with an operator, such as {{${body} == 'value'}} in simple. Tests in 
{{SimpleSyntaxHintsTest}}, which fail without the fix.

_Claude Code on behalf of davsclaus_

> camel-bean - the error of a call of equals on the body says to unmarshal the 
> body
> ---------------------------------------------------------------------------------
>
>                 Key: CAMEL-26041
>                 URL: https://issues.apache.org/jira/browse/CAMEL-26041
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-bean
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.24.0
>
>
> Camel does not call the methods of java.lang.Object on a bean 
> ({{BeanInfo.EXCLUDED_METHOD_NAMES}}: equals, hashCode, getClass, wait, notify 
> and the others), so {{${body.equals('x')}}} fails with a 
> {{MethodNotFoundException}} for any body. Since CAMEL-25749, 
> {{BeanExpression.invokeMethodIfPresent}} adds the body hint to the error of 
> an OGNL call on a body that is still the payload, so for a String body the 
> error says:
> {noformat}
> Failed to invoke method: equals('test-value-2') (the body is text (a String), 
> set by to at survey-s.camel.yaml:153: unmarshal it first with the data format 
> of the payload (such as unmarshal: json, unmarshal: jacksonXml or unmarshal: 
> csv) to read its fields) on the message body of type java.lang.String due to: 
> org.apache.camel.component.bean.MethodNotFoundException: Method with name: 
> equals('test-value-2') not found on bean: test-value-2 of type: 
> java.lang.String
> {noformat}
> The body is not why it failed, and unmarshalling it does not help: the 
> comparison is {{${body} == 'test-value-2'}}.
> Checked on 4.24.0-SNAPSHOT with {{camel run}}: a log of 
> {{same=${body.equals('test-value-2')}}} after an aws-secrets-manager 
> getSecret, found while adding the catalog body types of the AWS components 
> (CAMEL-24961).
> *Proposed change*: no body hint when the method is one Camel does not call; 
> say that instead, and for equals how to compare with the Simple operator.
> _Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to