-
Notifications
You must be signed in to change notification settings - Fork 38
Closed
Description
We can serialize a java.time.Instant through the WrappedMessage, where it writes an int64 and int32:
protostream/core/src/main/java/org/infinispan/protostream/WrappedMessage.java
Lines 293 to 298 in 8d20c39
| if (t instanceof Instant instant) { | |
| out.writeInt64(WRAPPED_INSTANT_SECONDS, instant.getEpochSecond()); | |
| out.writeInt32(WRAPPED_INSTANT_NANOS, instant.getNano()); | |
| out.flush(); | |
| return; | |
| } |
However, the conversion to JSON fails, resulting in an empty String. I see other (primitive) types work out of the box. A simple reproducer:
@Test
public void testInstant() throws Exception {
ImmutableSerializationContext ctx = createContext();
byte[] data = ProtobufUtil.toWrappedByteArray(ctx, Instant.EPOCH);
System.out.println(ProtobufUtil.toCanonicalJSON(ctx, data));
}I've run this from the ProtobufUtilTest class.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels