shashank created CAMEL-26886:
--------------------------------
Summary: camel-core - Simple: the other functions with arguments
drop an empty argument and split at a comma inside a nested function
Key: CAMEL-26886
URL: https://issues.apache.org/jira/browse/CAMEL-26886
Project: Camel
Issue Type: Bug
Components: camel-core
Reporter: shashank
Assignee: shashank
Follow-up of CAMEL-26465, named in its description.
CAMEL-26465 keeps an empty argument in its place, and does not split at a comma
inside a nested function, for the functions that use
{{SimpleFunctionHelper.splitArguments}} ({{replace}}, {{substring}},
{{substringBefore}}, {{substringAfter}}, {{substringBetween}}, {{contains}},
the collection functions with arguments) and {{join}}. The other functions with
arguments split their own way ({{StringQuoteHelper.splitSafeQuote}}, or
{{String.split}}) and still have both problems: {{concat}}, {{pad}},
{{convertTo}}, {{iif}}, {{hash}}, {{assert}}, {{throwException}},
{{function(...)}}, {{range}}, {{random}} and the math functions {{sum}},
{{max}}, {{min}}, {{average}}. An empty argument is dropped so the next one
takes its place (for example {{$\{hash(,SHA3-256)\}}} hashes the text
{{SHA3-256}}, {{$\{concat(,x)\}}} concats {{x}} with the body only by accident
of the order), and a comma inside a nested function such as
{{$\{header.s.substring(1,3)\}}} splits the argument, so
{{$\{iif($\{header.foo\} > 0,$\{header.s.substring(1,3)\},no)\}}} and
{{$\{random($\{header.min.substring(0,2)\},50)\}}} fail to parse.
*Proposal*
Split the arguments of these functions with the same rules
({{SimpleFunctionHelper.splitArgumentsAsWritten}}), with the same rule for an
empty argument (the default where the function has one: the body for an
expression the function otherwise reads from the body, 0 for the min of
{{range}} and {{random}}, SHA-256 for the algorithm of {{hash}}, a space for
the separator of {{pad}}, the default exception type; refused where it has
none), tests per function, and an upgrade guide entry next to the one of
CAMEL-26465. The values of {{sum}}, {{max}}, {{min}} and {{average}} are a
list, where an empty value stays no value, as for {{list}} and {{map}}.
_Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)