[
https://issues.apache.org/jira/browse/CAMEL-16061?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andrea Cosentino resolved CAMEL-16061.
--------------------------------------
Resolution: Fixed
> JSLT-Component: Object-Mapper changes large Decimal-Numbers (to scientific
> notation)
> ------------------------------------------------------------------------------------
>
> Key: CAMEL-16061
> URL: https://issues.apache.org/jira/browse/CAMEL-16061
> Project: Camel
> Issue Type: Improvement
> Affects Versions: 3.7.0
> Reporter: Nicolas Weber
> Assignee: Andrea Cosentino
> Priority: Major
> Fix For: 3.8.0
>
>
> Hi there,
> When using the JSLT-Component, large Decimal-Numbers seem to be represented
> in scientific notation and rounded (probably double). This changes the value
> itself, which is a big no no in my use cases.
> Example:
> in=> 11321321.12 : out => 1.132132112E7 (scientific)
> in=> 321321321.123657891234 : out => 3.213213211236579E8 (scientific and
> rounded)
> ObjectMapper (Jackson) is instantiated without config, which causes actually
> trouble with Decimal-Numbers as far as I know.
> Dealing with BigDecimal needs to be configured in Jackson. Since the
> ObjectMapper is instantiated in the Component itself, it's hard to get the
> Mapper-Instance.
>
> {code:java}
> <org.apache.camel.component.jslt.JsltEndpoint.onExchange(Exchange
> exchange):138> (decompiled source)
> protected void onExchange(Exchange exchange) throws Exception {
> .....................
> ObjectMapper objectMapper = new ObjectMapper();
> JsonNode input;
> if (exchange.getIn().getBody() instanceof String) {
> input = objectMapper.readTree((String)exchange.getIn().getBody(String.class));
> }
> ......................{code}
>
> [[email protected]] suggested following change:
> _"We can surely look at making this configurable, and also maybe some simple
> option you can turn on|off to affect the object mapper - so you dont need to
> configure a custom instance. So maybe its 2 things, 1 simple option to set
> true|false, and 2 to setup a custom ObjectMapper."_
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)