davsclaus opened a new pull request, #26806:
URL: https://github.com/apache/camel/pull/26806

   ## Summary
   
   A deep review of the simple language 
([CAMEL-24962](https://issues.apache.org/jira/browse/CAMEL-24962)) found about 
45 bugs. Each suspected bug was reproduced on `main` before it was fixed. There 
is one commit per sub-task:
   
   - **[CAMEL-24963](https://issues.apache.org/jira/browse/CAMEL-24963)**: 
fixes a regression from CAMEL-24921. `${properties:msg:value is not set}` was 
being read as an `is` predicate.
   - **[CAMEL-24964](https://issues.apache.org/jira/browse/CAMEL-24964)**, 
parser:
     - A single quote inside double quotes in a function made a predicate 
silently wrong: `${body.replace("'", "")} == 'x'` was true for any body.
     - A `}` inside double quotes broke everything after it.
     - `${body} ~> ${length()} > 5` failed to parse.
     - `~>` now needs a space on both sides, so `A~>B` is text.
     - Operators inside quoted text are text: `${body == 'a > b'}`.
     - Inside `${ }` the ternary `?` and `:` need whitespace around them.
   - **[CAMEL-24965](https://issues.apache.org/jira/browse/CAMEL-24965)**, init 
blocks:
     - A commented-out assignment ran anyway.
     - One-liner blocks (`$init{ $a := 1; }init$`) and CRLF line endings now 
work.
     - A predicate whose init block only defines functions now parses.
     - A custom function defined in one expression leaked into another 
expression through the cache.
     - Error positions pointed at the wrong place.
   - **[CAMEL-24966](https://issues.apache.org/jira/browse/CAMEL-24966)**, 
operators and numbers:
     - `${body > 0 ? 1 : 0}` evaluated as `Long` threw a ClassCastException.
     - Negative long literals did not parse.
     - `?:` treats any numeric zero as falsy.
     - `1.5++` is `2.5`.
     - `range` and `regex` no longer throw a NullPointerException when the 
right-hand side is null.
   - **[CAMEL-24967](https://issues.apache.org/jira/browse/CAMEL-24967)**, 
function arguments:
     - Quotes inside a nested function argument are kept.
     - `convertTo(${x.trim()},T)` works.
     - A comma inside quotes stays part of the argument.
     - Too few arguments gives a syntax error.
     - `bean:type:` works with a dotted class name.
     - A quoted key such as `['a.b']` is a key, not OGNL.
     - A name glued to a function name (`${headerfoo}`) is an unknown function.
   - **[CAMEL-24968](https://issues.apache.org/jira/browse/CAMEL-24968)**, 
string, math, date and file functions:
     - `capitalize("")` no longer throws.
     - `sum()`, `max()`, `min()` and `average()` work on the body.
     - `date:header.Last-Modified` and `date:header.my.date` read the right 
header.
     - `GMT+02:00` works as a time zone.
     - `safeQuote` produces valid JSON.
     - `pad` fills to exactly the given width.
     - `size()` works on any array.
     - A leading dot is a hidden file name, not an extension.
     - The `substring` docs are corrected.
   - **[CAMEL-24969](https://issues.apache.org/jira/browse/CAMEL-24969)**, 
collection functions:
     - `range(max)` starts at 0, as documented and as in Python.
     - The `split` separator is plain text.
     - `sort(${header.list})` sorts the given list, not the body.
     - A space after a comma no longer leaks into the argument.
     - `${uuid()}` works.
     - A body that is just `,` no longer fails.
   - **[CAMEL-24970](https://issues.apache.org/jira/browse/CAMEL-24970)**, 
catalog, docs and syntax hints: the catalog names and examples now match the 
code (`hostname`, `exception.stacktrace`, `throwException(msg,type)`, ...), and 
the did-you-mean hints suggest current function names.
   - **[CAMEL-24971](https://issues.apache.org/jira/browse/CAMEL-24971)**, 
tidy-ups:
     - The unused static singleton and the always-true `strict` flag are 
removed.
     - `ObjectHelper` is imported instead of written as a fully qualified name.
     - `&&` and `||` build their predicate once instead of on every message.
   
   Small fixes in camel-util (`StringHelper` capitalize and split helpers, 
`FileUtil` hidden files) and camel-support (`LanguageHelper` dotted date keys) 
are included where the simple functions reach them.
   
   ## Behaviour changes
   
   These are listed in the 4.23 upgrade guide:
   - `split` separator is plain text, not a regex.
   - `range(max)` starts at 0.
   - `?:` treats any zero as falsy.
   - `++` and `--` keep decimals.
   - `safeQuote` escapes.
   - `kindOfType` of a Map is `object`.
   - Names glued to a function (such as `${headerfoo}`) are unknown.
   - Hidden file names have no extension.
   - `~>` and the ternary need spaces.
   - Catalog name corrections.
   
   ## Tests
   
   New test classes:
   - `SimpleParserEdgeCasesTest`
   - `SimpleInitBlockEdgeCasesTest`
   - `SimpleFunctionArgumentsTest`
   - `SimpleStringMathDateFunctionsTest`
   
   New tests were added to the existing simple, collection function, `FileUtil` 
and `StringHelper` tests. Full test runs pass locally for camel-util, 
camel-support and camel-core (7,484 tests in camel-core, 0 failures).
   
   _Claude Code on behalf of davsclaus_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to