Claus Ibsen created CAMEL-25366:
-----------------------------------

             Summary: 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


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)

Reply via email to