You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by je...@apache.org on 2021/12/15 16:48:19 UTC

[camel] branch camel-3.14.x updated: CAMEL-17336: camel-jackson: useList has no effect (#6540)

This is an automated email from the ASF dual-hosted git repository.

jeremyross pushed a commit to branch camel-3.14.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-3.14.x by this push:
     new 2e69826  CAMEL-17336: camel-jackson: useList has no effect (#6540)
2e69826 is described below

commit 2e6982655246d1a6507ba582781ddb495b133d07
Author: Jeremy Ross <je...@gmail.com>
AuthorDate: Tue Dec 14 12:35:24 2021 -0600

    CAMEL-17336: camel-jackson: useList has no effect (#6540)
    
    If an ObjectMapper from the registry is used, useList=true has no
    effect.
---
 .../apache/camel/component/jackson/AbstractJacksonDataFormat.java  | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/AbstractJacksonDataFormat.java b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/AbstractJacksonDataFormat.java
index 67f838d6..b338ca9 100644
--- a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/AbstractJacksonDataFormat.java
+++ b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/AbstractJacksonDataFormat.java
@@ -533,6 +533,10 @@ public abstract class AbstractJacksonDataFormat extends ServiceSupport
 
     @Override
     protected void doStart() throws Exception {
+        if (useList) {
+            setCollectionType(ArrayList.class);
+        }
+
         boolean objectMapperFoundRegistry = false;
         if (objectMapper == null) {
             // lookup if there is a single default mapper we can use
@@ -559,9 +563,6 @@ public abstract class AbstractJacksonDataFormat extends ServiceSupport
         }
 
         if (!objectMapperFoundRegistry) {
-            if (useList) {
-                setCollectionType(ArrayList.class);
-            }
             if (include != null) {
                 JsonInclude.Include inc
                         = getCamelContext().getTypeConverter().mandatoryConvertTo(JsonInclude.Include.class, include);