Hi,
On Tuersday, 18. May 2021, 20:49:43 CEST Vladislav Kalko wrote:
> Hello!
> I noticed following issue while using XStream library bundled in Quarkus
> (tested using default version 1.4.14 and latest 1.4.17 added manually):
>
> during deserialization of Externalizable object (of avro-generated class),
> which has field of type Long and value greated than 1073741823L following
> exception appears:
>
> com.thoughtworks.xstream.converters.ConversionException:
> ---- Debugging information ----
> cause-exception : java.lang.ClassCastException
> cause-message : class [B cannot be cast to class java.lang.Byte ([B
> and java.lang.Byte are in module java.base of loader 'bootstrap')
> class : org.acme.Entity
> required-type : org.acme.Entity
> converter-type :
> com.thoughtworks.xstream.converters.reflection.ExternalizableConverter
> path : /org.acme.Entity
> line number : 4
> version : 1.4.17
> -------------------------------
> If value of the field is 1073741823L and less, there is no error.
>
> Project to reproduce:
https://github.com/vkalko/XStreamAvroIssue
> Just run MainTest in test/java/org/acme
> <
https://github.com/vkalko/XStreamAvroIssue/tree/master/src/test/java/org/ac
> me> .
Sorry, I am mot involved in Quarkus and the code you've provided does not use
XStream in any visible way. I have no idea what Quarkus does with XStream and
how it sets up its configuration.
However, I can assure you, that XStream will deserialize "<long>1073741824</
long>" without any problem into the appropriate Long value.
> I will really appreciate any help and will glad to answer your questions
> and provide additional information if necessary.
The error message implies that XStream is deserializing a byte array and no
long value at all. You will have to look at Quarkus. If I had to guess, I
would look at the BinaryMessageEncoder/BinaryMessageDecoder which seems to be
indirectly used by the calls to for readExternal/writeExternal.
Regards,
Jörg