This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch fix/CAMEL-24976 in repository https://gitbox.apache.org/repos/asf/camel.git
commit 9389fed9e18416a7b85805351ac72e320165bfc8 Author: Claus Ibsen <[email protected]> AuthorDate: Wed Sep 23 21:51:29 2026 +0200 CAMEL-24976: type converter - upgrade guide Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../ROOT/pages/camel-4x-upgrade-guide-4_23.adoc | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc index eace13660003..bcf5816c0f6b 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc @@ -557,6 +557,33 @@ set here, because that would reject input that parses today. Routes that genuine an external DTD or parameter entity through this converter must supply their own `SAXParserFactory`. +=== camel-core - type converter + +Several bugs in the type converter have been fixed, and some of the fixes change behavior: + +* Converting to a primitive type (such as `int.class`) now returns the matching wrapper type. +Before, an `Integer` or `Long` value was returned as-is for any primitive type, so +`convertTo(int.class, 5L)` returned a `Long`. For example, a bean method with an `int` parameter +failed with `argument type mismatch` when the message body was a `Long`. +* `tryConvertTo(boolean.class, value)` returns `null` instead of throwing an exception when the value +cannot be converted. +* When no type converter can convert a pair of types, the registry records a miss so it does not +search for a converter again. Fallback type converters are now still tried for such a pair, +because a fallback converter can convert depending on the value. Recorded misses are also cleared when +a type converter or fallback type converter is added. +* When there is no type converter for the exact type of the value, the registry uses a type converter +for a super type. This used to depend on the iteration order of an internal map, which could change +between JVM restarts. The nearest super type now wins: the type hierarchy is walked breadth-first, +interfaces are tried before the super class at each level, and `java.lang.Object` is tried last. +* Converting a `String` to a `Number` now returns an `Integer` for all values within the `Integer` range +(including `Integer.MAX_VALUE`, which returned a `Long` before), and supports exponent notation such as `1e5`. +* Converting a `BigDecimal`, or a `double` larger than a `long`, to `BigInteger` no longer loses precision. +* Converting a `byte[]` to `char` no longer sign-extends bytes above 127. +* Converting a `String` to `ByteBuffer` now uses the charset from the `CamelCharsetName` header or exchange +property (like the other converters), and falls back to the default charset. +* Converting an array to a `Set` no longer returns a `List`. +* Enum conversion prefers a constant that matches exactly before matching case-insensitively. + === camel-core - a failed route reload restores the previous routes When a route file is reloaded in dev mode (`camel run --dev`, or the route watcher reload strategy in general) and
