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

Claus Ibsen updated CAMEL-25118:
--------------------------------
    Fix Version/s: 4.23.0

> camel-catalog - Endpoint and configuration validation: fix bugs found in a 
> deep review
> --------------------------------------------------------------------------------------
>
>                 Key: CAMEL-25118
>                 URL: https://issues.apache.org/jira/browse/CAMEL-25118
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-catalog
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.23.0
>
>
> The endpoint and configuration validation in camel-catalog (used by the 
> validate maven plugin, the Camel CLI and tooling) has a number of parsing and 
> validation bugs:
> # An option of type object with a plain value is reported as "Invalid 
> reference ... must start with #", even for placeholders, the default value, 
> or options of type java.lang.Object that accept string values (eg 
> {{file:inbox?scheduler=spring}}, {{google-storage:b?storageClass=STANDARD}}, 
> {{jms:queue:foo?connectionFactory=\{\{cf\}\}}}).
> # When an optional path option in the middle of the syntax is omitted, the 
> path values are assigned to the wrong options (eg {{ftp://h:21}} gives 
> directoryName=21 instead of port=21, same for xmpp and netty-http). This also 
> hides type errors such as {{ftp://h:abc}}.
> # asEndpointUri corrupts path values that contain property placeholders when 
> an optional path option is missing (eg host=h, directoryName=\{\{dir\}\} 
> gives {{ftp:h/\{\{\{\{dir\}\}}}).
> # An {{\{\{env:X\}\}}} or {{\{\{sys:X\}\}}} placeholder that is a whole path 
> option was removed and reported as a missing required option (eg 
> {{kafka:\{\{env:TOPIC\}\}}}), and placeholders with a default value 
> ({{\{\{env:NS:default\}\}}}) were not handled.
> # The query parser splits on & inside RAW(...) and RAW\{...\} values, which 
> the runtime does not.
> # The query parser loses values when a parameter is repeated ({{x=a&x=b&x=c}} 
> gives [a, c] instead of [a, b, c]).
> # The optional consumer. prefix was removed from every option, so invalid 
> uris such as {{timer:foo?consumer.delay=1000}} were accepted; the prefix only 
> applies to the options that declare it (such as exceptionHandler).
> # Integer options of type long are validated as int (eg 
> {{timer:foo?repeatCount=5000000000}}).
> # summaryErrorMessage does not include invalid duration values, so the 
> summary does not say what is wrong (EndpointValidationResult and 
> ConfigurationPropertiesValidationResult).
> # validateConfigurationProperty computes the suggestions for an unknown 
> option from the component name instead of the option name, and stores them 
> under a different key than the unknown option.
> # validateConfigurationProperty throws StringIndexOutOfBoundsException for a 
> key without an option (eg {{camel.component.kafka=foo}}).
> # validateProperties(scheme, map) reads the lenient value as a system 
> property name (Boolean.getBoolean), ignores lenient components, and throws 
> NPE for an unknown scheme.
> # asEndpointUri wraps a value containing ) as RAW(...), which ends the raw 
> value too early; RAW\{...\} is used instead.
> # The userinfo in the authority (user:password@host) is split at the first @ 
> and only when there is a single colon; it should use the last @ and split at 
> the first colon, as the runtime does.
> # validateLanguageExpression throws NPE when options are given and the 
> language is not on the classpath.
> *Not changed*
> * sftp has no alternativeSyntax in its metadata, so user:password@host is not 
> parsed as userinfo for sftp. This needs a metadata change and regeneration in 
> the component, so it is left for a separate change.
> * Simple validation of a predicate with a placeholder operand after && (eg 
> {{$\{body\} == 'a' && \{\{flag\}\}}}) is still reported as invalid.
> * The catalog duration validation (TimePatternConverter) differs from the 
> runtime TimeUtils in some cases. This is best aligned after the pending 
> TimeUtils changes are merged.
> _Claude Code on behalf of Claus Ibsen_



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

Reply via email to