davsclaus opened a new pull request, #26983: URL: https://github.com/apache/camel/pull/26983
Fixes [CAMEL-25083](https://issues.apache.org/jira/browse/CAMEL-25083): bugs in `org.apache.camel.support.ObjectHelper`, found in a deep review. **Changes:** 1. **Simple `contains` on a collection:** each element is now type coerced, as an array already was. `${header.ids} contains '2'` is now true for a `List` of the numbers 1, 2, 3. 2. **`contains` with ignoreCase on a collection:** elements are now compared whole, ignoring case, not as substrings, and null elements or values no longer throw a NullPointerException. 3. **A String equals a boolean only when it is `true` or `false`,** ignoring case. Before, `${body} == false` was true for a body of `hello`. This applies to both `typeCoerceEquals` and `typeCoerceCompare`. 4. **`createIterator(";", ";")` and `createIterator(":::", "::")`:** a String that is only the delimiter, or whose start and end delimiters overlap, now gives an empty iterator. Before, it threw StringIndexOutOfBoundsException. This affects the Splitter with a custom delimiter and the `uriDelimiter` of recipientList, routingSlip and dynamicRouter. 5. **A pattern delimiter that can match an empty string** (such as `\s*`) no longer loops forever. 6. **`compare` on `Ordered` values:** it now uses `Integer.compare`, both for the order and for the hashCode fallback. Before, the subtraction overflowed, so `Ordered.HIGHEST` sorted last. The upgrade guide for 4.23 documents the behavior changes in items 1 to 3. **Not changed:** - The numeric comparison paths (CAMEL-25013). - `contains` on a String keeps its substring semantics. **Tests:** - New: `ObjectHelperEdgeCasesTest` (camel-core), with 8 tests, including simple-language level `contains` and `== false` checks. All 8 fail without the fix. - Existing: - The simple, ObjectHelper, splitter, predicate and sort tests pass (1213 tests). - A full camel-core run failed 20 tests (14 failures, 6 errors) in 4 classes: `ResequencerEngineTest`, `StreamResequencerRestartTest`, `PropertiesComponentCircularReferenceTest` and `ClusteredRoutePolicyReleaseDeadlockTest`. That run had only camel-support and camel-core in the reactor, so it used older jars for the other core modules. Re-run with `-am`, all 4 classes pass. The full camel-core suite has not been re-run with `-am`. _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]
