Claus Ibsen created CAMEL-27798:
-----------------------------------
Summary: camel-jslt: contentCache=false has no effect,
mapBigDecimalAsFloats changes a shared ObjectMapper per message
Key: CAMEL-27798
URL: https://issues.apache.org/jira/browse/CAMEL-27798
Project: Camel
Issue Type: Bug
Components: camel-jslt
Reporter: Claus Ibsen
Fix For: 4.25.0
Found while improving the option descriptions of camel-jslt for CAMEL-23832
(pull request https://github.com/apache/camel/pull/31137).
These are separate problems of the component; the descriptions change only
documents the current behavior.
h4. 1. contentCache=false has no effect
{{JsltEndpoint.getTransform()}} caches the compiled Expression in the
{{transform}} field regardless of isContentCache(), and reads the resource with
{{ResourceHelper.resolveMandatoryResourceAsInputStream}}, not
{{getResourceAsInputStream()}}. Only clearContentCache() over JMX resets it.
Proposed change: cache it only when contentCache is true.
h4. 2. mapBigDecimalAsFloats changes the user's ObjectMapper on every message
With mapBigDecimalAsFloats=true, onExchange calls
{{objectMapper.enable(USE_BIG_DECIMAL_FOR_FLOATS)}} on the configured (shared)
ObjectMapper for every message; without one it creates a new ObjectMapper per
message.
Proposed change: create the default mapper once and use
{{objectMapper.reader().with(...)}}.
h4. 3. Every message takes the endpoint lock
getTransform() takes the lock even when the Expression is cached and compiles
header expressions while holding it, so all messages to the endpoint are
serialized (performance).
h4. 4. CamelJsltString is not removed after use
Unlike CamelJsltResourceUri, the header stays on the message.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)