You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.
Originally posted by Adorjann July 17, 2023
Hi, I would like to serialize an object that contains a field of type Throwable.
class ObjectToSerialize{
Throwable throwable;
}
public class Main {
public static void main(String[] args) {
ObjectToSerialize objectToSerialize = new ObjectToSerialize();
final SerializerFoundation<?> foundation = SerializerFoundation.New()
.registerEntityTypes(ObjectToSerialize.class);
final Serializer<byte[]> serializer = TypedSerializer.Bytes(foundation); //line 18
byte[] data = serializer.serialize(objectToSerialize);
ObjectToSerialize restored = serializer.deserialize(data);
}
}
The code above produces:
Exception in thread "main" one.microstream.persistence.exceptions.PersistenceExceptionTypeNotPersistable: Type not persistable: "class java.lang.Throwable".
at one.microstream.persistence.binary.internal.BinaryHandlerUnpersistable.guaranteeSubTypeInstanceViablity(BinaryHandlerUnpersistable.java:98)
at one.microstream.persistence.types.PersistenceTypeHandlerManager$Default.lambda$recursiveEnsureTypeHandlers$0(PersistenceTypeHandlerManager.java:278)
at one.microstream.persistence.binary.internal.AbstractBinaryHandlerReflective.iterateMemberTypes(AbstractBinaryHandlerReflective.java:591)
at one.microstream.persistence.types.PersistenceTypeHandlerManager$Default.recursiveEnsureTypeHandlers(PersistenceTypeHandlerManager.java:271)
at one.microstream.persistence.types.PersistenceTypeHandlerManager$Default.registerTypeHandler(PersistenceTypeHandlerManager.java:639)
at one.microstream.persistence.types.PersistenceTypeHandlerManager$Default.internalEnsureTypeHandler(PersistenceTypeHandlerManager.java:616)
at one.microstream.persistence.types.PersistenceTypeHandlerManager$Default.ensureTypeHandler(PersistenceTypeHandlerManager.java:384)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at one.microstream.persistence.binary.util.SerializerFoundation$Default.createPersistenceManager(SerializerFoundation.java:211)
at one.microstream.persistence.binary.util.TypedSerializer$Default.initialize(TypedSerializer.java:372)
at one.microstream.persistence.binary.util.TypedSerializer$Default.<init>(TypedSerializer.java:262)
at one.microstream.persistence.binary.util.TypedSerializer.New(TypedSerializer.java:145)
at one.microstream.persistence.binary.util.TypedSerializer.Bytes(TypedSerializer.java:117)
at com.testing.Main.main(Main.java:18)
If you can please point me to documentation or an example explaining how to do this.
Many Thanks!
The text was updated successfully, but these errors were encountered:
Serializing Throwable and derived types is currently not supported by intend.
Nevertheless, there are use cases that can benefit from serializing Throwables. Therefore, keep that issue as an enhancement.
Discussed in #612
Originally posted by Adorjann July 17, 2023
Hi, I would like to serialize an object that contains a field of type Throwable.
The code above produces:
If you can please point me to documentation or an example explaining how to do this.
Many Thanks!
The text was updated successfully, but these errors were encountered: