davsclaus opened a new pull request, #26924: URL: https://github.com/apache/camel/pull/26924
Fixes [CAMEL-25044](https://issues.apache.org/jira/browse/CAMEL-25044): bugs in `ExpressionBuilder`, `PredicateBuilder` and `ValueBuilder` found in a deep review. Each fix has a test in `ExpressionBuilderEdgeCasesTest` that fails without it. 1. **`<` is true when both sides are null.** `isLessThan` returned `true` for two nulls, while `>` returns `false`, so `${header.a} < ${header.b}` was true when neither header existed. This goes back to 2009. `<=` and `>=` stay true for two nulls. 2. **`PredicateBuilder.language` evaluates on an exchange shared by all threads.** It set the body on `ExchangeHelper.getDummy`, a single static exchange, and gave about 10% wrong answers with 8 threads. It now uses a new exchange per evaluation, as `languageExpression` already does. 3. **A missing variable as the `source` of a language gives a `null` input.** `header:` and `property:` sources are mandatory, and `variable:` was mandatory until the CAMEL-20378 refactoring (4.4) dropped the flag. It now fails with `NoSuchVariableException`. 4. **`in(...)` with a `null` value never matches a missing value.** `convertToExpression` returned the `Expression` object itself instead of its value when the type is null. 5. **`${join}` drops the separators of leading empty elements**, so `["", "", "c"]` gave `c` instead of `,,c`. 6. **`headerExpression(name, byte[].class)` and `variableExpression(name, byte[].class)` always fail.** The type was resolved by its binary name `[B`. Arrays now use their canonical name. Other types keep the binary name, so nested classes still resolve. 7. **A null constant in an optimized concat adds the text `"null"`**, while the evaluated path skips nulls. 8. **`languageExpression(expression, ...)` does not init its input expression.** It is used by the mock component's language expectations. **Not changed** - `ExchangeHelper.getDummy` itself: its other callers only use it while routes are created. - `sortExpression` sorts a `List` body in place, and `beanExpression` creates a new bean expression on every evaluation. Both are long-standing and don't give wrong results. 1 and 3 change behaviour and are in the 4.23 upgrade guide. The whole `camel-core` test suite passes. _Claude Code on behalf of Claus Ibsen_ 🤖 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]
