You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Keith Herbert <kh...@redhat.com> on 2021/02/19 22:25:05 UTC

BUG: camel-jacksonxml swallows repeated elements in XML list

When parsing an XML string containing repeated nested elements such as

<a>
    <b>1</b>
    <b>2</b>
    <b>3</b>
</a>

with

.unmarshal().jacksonxml()

the resulting body only has the last <b> element.

This is a known bug in jackson-databind-xml which was fixed in version
2.12.0
However, Camel 3.8.1 still uses 2.11.4 and the latest supported version for
FUSE still uses 2.9.10

I created a simple unit test that demonstrates this bug in both the latest
community and FUSE versions.
https://github.com/herbertkb/jacksonxml-lists-bug

Simply cd into either and run mvn clean test. In the logs you can see:

INFO  Pre unmarshal:
<root><list><item>ONE</item><item>TWO</item><item>THREE</item></list></root>
INFO  Post unmarshal: {list={item=THREE}}

I think the solution may be to simply bump the versions, but I got a
ClassDefNotFound error when trying to bump it by excluding
jackson-databind-xml from camel-jacksonxml and adding it back as 2.12.0

Thanks for your time,
Keith

Re: BUG: camel-jacksonxml swallows repeated elements in XML list

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Yeah we will upgrade jackson in the future.
There are a number of other components using it, so the upgrade is
usually coordinated a bit.

You can create a JIRA about upgrade jackson to 2.12.x and lets see if
we can get this in 3.9 or 3.10

On Mon, Feb 22, 2021 at 10:27 AM Keith Herbert <kh...@redhat.com> wrote:
>
> When parsing an XML string containing repeated nested elements such as
>
> <a>
>     <b>1</b>
>     <b>2</b>
>     <b>3</b>
> </a>
>
> with
>
> .unmarshal().jacksonxml()
>
> the resulting body only has the last <b> element.
>
> This is a known bug in jackson-databind-xml which was fixed in version
> 2.12.0
> However, Camel 3.8.1 still uses 2.11.4 and the latest supported version for
> FUSE still uses 2.9.10
>
> I created a simple unit test that demonstrates this bug in both the latest
> community and FUSE versions.
> https://github.com/herbertkb/jacksonxml-lists-bug
>
> Simply cd into either and run mvn clean test. In the logs you can see:
>
> INFO  Pre unmarshal:
> <root><list><item>ONE</item><item>TWO</item><item>THREE</item></list></root>
> INFO  Post unmarshal: {list={item=THREE}}
>
> I think the solution may be to simply bump the versions, but I got a
> ClassDefNotFound error when trying to bump it by excluding
> jackson-databind-xml from camel-jacksonxml and adding it back as 2.12.0
>
> Thanks for your time,
> Keith



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2