Claus Ibsen created CAMEL-24836:
-----------------------------------

             Summary: PropertyBindingException from camel-main configuration 
hides the cause: the message should carry the root cause
                 Key: CAMEL-24836
                 URL: https://issues.apache.org/jira/browse/CAMEL-24836
             Project: Camel
          Issue Type: Improvement
          Components: camel-core
            Reporter: Claus Ibsen


Starting with

{code}
camel.component.rest-openapi.host=http://localhost:8080/api
{code}

fails with

{code}
Error starting Camel: org.apache.camel.PropertyBindingException: Error binding 
property (camel.component.rest-openapi.host=http://localhost:8080/api) with 
name: host on bean: 
org.apache.camel.component.rest.openapi.RestOpenApiComponent@56826a75 with 
value: http://localhost:8080/api
{code}

The reason is two {{Caused by}} lines down the stack trace:

{code}
Caused by: java.lang.IllegalArgumentException: host must be an absolute URI 
(e.g. http://api.example.com), given: `http://localhost:8080/api`
{code}

The first line is what a person reads, what an IDE shows, and what a coding 
agent gets when the log is trimmed; it says the binding failed and nothing 
about why. {{PropertyBindingException.getMessage()}} (or the main support's 
error reporting) should append the message of the root cause when there is one: 
"... with value: http://localhost:8080/api: host must be an absolute URI (e.g. 
http://api.example.com)".

Found in the round-2 local-model benchmark on the camel-jbang-examples ladder: 
the model set the host with a path, read the first line, and could only guess. 
The same applies to every setter that throws an IllegalArgumentException with a 
good message.



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

Reply via email to