[
https://issues.apache.org/jira/browse/CAMEL-26006?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18130939#comment-18130939
]
Claus Ibsen commented on CAMEL-26006:
-------------------------------------
Fix in PR https://github.com/apache/camel/pull/28355 (one PR for the 16 data
format tickets CAMEL-25995 to CAMEL-26011, except CAMEL-26000). The PR
description lists the change per ticket.
_Claude Code on behalf of davsclaus_
> camel-cbor - unmarshal without unmarshalType fails, which is the first
> example of the docs
> ------------------------------------------------------------------------------------------
>
> Key: CAMEL-26006
> URL: https://issues.apache.org/jira/browse/CAMEL-26006
> Project: Camel
> Issue Type: Bug
> Components: camel-cbor
> Affects Versions: 4.18.0, 4.22.0, 4.23.0
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 4.24.0
>
>
> The cbor data format has no default {{unmarshalType}} ({{CBORDataFormat}},
> main 56aa5f4970a6, line 61), and unmarshal passes it to
> {{objectMapper.readerFor(clazz)}} (line 118). Without {{unmarshalType}},
> every unmarshal fails with {{InvalidDefinitionException: No value type
> configured for ObjectReader}}. With {{useList=true}} it fails with a
> NullPointerException in {{constructCollectionType(collectionType, null)}}
> (line 115). This has been so since the first commit (CAMEL-10324). The first
> example of the cbor docs is exactly this case: {{unmarshal().cbor()}},
> {{<cbor/>}} and {{cbor: {}}}. The Jackson JSON data format defaults to a Map.
> Checked on 4.24.0-SNAPSHOT with {{camel run}}:
> * a Map, then {{marshal: cbor}}, then {{unmarshal: cbor}}: the
> InvalidDefinitionException;
> * the same with a List, or a String: the same;
> * the same with {{useList: true}}: the NullPointerException;
> * {{unmarshalType}} set to a POJO class: the POJO.
> *Proposed change*: default to {{Object.class}} as JacksonDataFormat does,
> which gives a Map for a CBOR map and a List for an array. Then update the
> body types of the data format (unmarshalOut map and list) with it
> (CAMEL-24961).
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)