RecordConverter issue

11 views
Skip to first unread message

Naeem Akhtar

unread,
Nov 3, 2024, 4:33:56 PM11/3/24
to XStream User
The RecordConverter in 1.5.0-SNAPSHOT has an issue.

When the record is marshalled, the alias (serializedClassName) is added the the XML. During unmarhsalling, the class is instantiated with this alias rather that the real class. And of course, it is going to fail. 

The test case, RecordConverterTest, passes because it only has primitive types.

The fix is the call Mapper::realClass during unmarhalling.

I have a tested patch available in case if someone needs it.

Naeem Akhtar

unread,
Nov 4, 2024, 2:15:35 PM11/4/24
to XStream User
Patch attached.
record.patch

Jörg Schaible

unread,
Nov 4, 2024, 5:18:41 PM11/4/24
to XStream User
Hi Naeem,

On Sunday, 3rd November 2024, 22:33:55 CET Naeem Akhtar wrote:
> The RecordConverter in 1.5.0-SNAPSHOT has an issue.

It has a lot of issues.

> When the record is marshalled, the alias (serializedClassName) is added the
> the XML. During unmarhsalling, the class is instantiated with this alias
> rather that the real class. And of course, it is going to fail.
>
> The test case, RecordConverterTest, passes because it only has primitive
> types.
>
> The fix is the call Mapper::realClass during unmarhalling.
>
> I have a tested patch available in case if someone needs it.

The converter was also a contribution and it is a first implementation using
the official Java API to access the content of a record, but it does not yet
support the rest of the stuff. There's no aliasing, no local converters, no
attribute support, etc. It is not really in a state for production.

Regards,
Jörg




Reply all
Reply to author
Forward
0 new messages