[
https://issues.apache.org/jira/browse/CAMEL-24965?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen resolved CAMEL-24965.
---------------------------------
Resolution: Fixed
Fixed by https://github.com/apache/camel/pull/26806 (merged as cbe03f3fee0d).
_Claude Code on behalf of davsclaus_
> simple - init block fixes (custom function leak, comments, one-liners,
> predicates)
> ----------------------------------------------------------------------------------
>
> Key: CAMEL-24965
> URL: https://issues.apache.org/jira/browse/CAMEL-24965
> Project: Camel
> Issue Type: Sub-task
> Components: camel-core
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Major
> Fix For: 4.23.0
>
>
> Bugs in SimpleInitBlockTokenizer / SimpleInitBlockParser /
> InitBlockExpression.
> * (verified) Custom functions leak between expressions: {{$f ~:= ${trim()}}}
> in one expression and {{$f ~:= ${uppercase()}}} in another; the second
> returns the trimmed value. $f() is rewritten to ${function(f)}, which is
> cached in the shared expression cache, and the registry is CamelContext
> global (last writer wins, and can replace a user SimpleFunction bean of the
> same name). The docs call it a local custom function.
> * (verified) Commented-out assignments still run: {{$init\{ // $foo := 'x';
> ... \}init$}} defines $foo. newLine starts true and is never reset;
> setAcceptInitTokens/hasNewLine are never called. A comment such as {{// costs
> $5}} fails with "expected symbol initOperator".
> * (verified) The one-liner shown in simple-operators.adoc ({{$init\{ $minAge
> := 18; \}init$}}) sets the value to "18; " because ; must be followed by a
> newline. Same issue for a trailing comment or CRLF line endings. Either
> support it or fix the docs.
> * (verified) A predicate whose init block only defines ~:= functions fails
> with "Unexpected token $init{": InitBlockExpression returns null for ~:=, and
> SimplePredicateParser ~94 only cuts off the block when init != null. The
> predicate parser also never rewrites $fn() the way SimpleExpressionParser
> does.
> * ChainExpression rewrites {{$foo(}} to {{function(foo}} without the comma,
> so {{$foo('x')}} in a chain becomes a lookup of "foo'x'".
> * Init-block syntax error positions are 6 characters early (index is relative
> to the text after $init{).
> _Claude Code on behalf of davsclaus (found by an AI review of the simple
> language source; each item marked (verified) was reproduced on main at
> c3ef718de2e8)_
--
This message was sent by Atlassian Jira
(v8.20.10#820010)