FasterXML / jackson-dataformats-binary

Uber-project for standard Jackson binary format backends: avro, cbor, ion, protobuf, smile
Apache License 2.0
310 stars 133 forks source link

[Ion] IonValueDeserializer can't deserialize IonTimestamps #243

Closed jessbrya-amzn closed 3 years ago

jessbrya-amzn commented 3 years ago

To reproduce:

IonSystem ion = IonSystemBuilder.standard().build();
IonValueMapper ionValueMapper = new IonValueMapper(ion);

IonTimestamp timestamp = ion.newUtcTimestamp(new Date());
String serialized = ionValueMapper.writeValueAsString(timestamp);
// The next line fails with the ClassCastException
IonTimestamp restored = ionValueMapper.readValue(serialized, IonTimestamp.class);

When deserializing an IonTimestamp, the IonParser returns a com.amazon.ion.Timestamp for getEmbeddedObject(), which the IonValueDeserializer attempts to cast to an IonValue.

The above links also exhibit that this same problem exists for the IonBlob and IonClob types (trying to cast a byte[] to an IonValue).