Claus Ibsen created CAMEL-27301:
-----------------------------------

             Summary: camel-jackson3 - converting a JsonNode to a Map fails 
with a NullPointerException when no exchange is given
                 Key: CAMEL-27301
                 URL: https://issues.apache.org/jira/browse/CAMEL-27301
             Project: Camel
          Issue Type: Bug
          Components: camel-jackson
            Reporter: Claus Ibsen
             Fix For: 4.24.0


{{JacksonTypeConverters.toMap(JsonNode node, Exchange exchange)}} in 
camel-jackson3 calls {{exchange.getContext()}}, but a type converter can be 
called without an exchange. The simple language does that for 
{{${body[field]}}}, so {{${body[name]}}} on a Jackson 3 {{ObjectNode}} body 
fails with a {{NullPointerException}}.

camel-jackson has the same code in its {{JacksonTypeConverters.toMap}}; it 
should be checked too, together with the other converters there that call 
{{exchange.getContext()}}.

Expected: without an exchange, the converter uses the default {{ObjectMapper}} 
(as {{resolveObjectMapper}} would for a context without one), and 
{{${body[field]}}} gives the field of the {{ObjectNode}}.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to