[
https://issues.apache.org/jira/browse/CAMEL-25366?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen resolved CAMEL-25366.
---------------------------------
Resolution: Fixed
Merged in https://github.com/apache/camel/pull/27402 (commit a24e8e2e8e9b) for
4.23.0.
_Claude Code on behalf of davsclaus_
> camel-core - No type converter from String or Number to BigDecimal, so simple
> bodyAs/convertTo/resultType BigDecimal give null
> ------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-25366
> URL: https://issues.apache.org/jira/browse/CAMEL-25366
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 4.23.0
>
>
> Camel core has type converters from String, Number and byte[] to Byte, Short,
> Integer, Long, Float, Double and BigInteger, but none to java.math.BigDecimal.
> So converting the String "1000.01" to BigDecimal returns null without an
> error, and the simple language shows it as empty:
> {code}
> ${bodyAs(java.math.BigDecimal)}
> ${convertTo(${body}, java.math.BigDecimal)}
> simple with resultType: java.math.BigDecimal
> {code}
> Comparisons such as ${body} > 1000 work because the comparison parses
> decimals itself (CAMEL-25013), which hides the gap.
> This is common for money amounts read from CSV or JSON. Add a toBigDecimal
> converter next to toBigInteger in ObjectConverter.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v8.20.10#820010)