The following code works prior to version 3.4. but does not in 3.5.0-Snapshot
@Test
public void testDecode() {
StringWriter stringWriter = new StringWriter();
JsonWriter writer = new JsonWriter(stringWriter, new JsonWriterSettings(true));
CodecRegistry codecRegistry = CodecRegistries.fromRegistries(MongoClient.getDefaultCodecRegistry());
Codec<Document> documentCodec = codecRegistry.get(Document.class);
Document document = new Document("dateList", Arrays.asList(new Date(), new Date()));
documentCodec.encode(writer, document, EncoderContext.builder().build());
Document decoded = documentCodec.decode(new JsonReader(stringWriter.toString()), DecoderContext.builder().build());
}
While decoding, it throws an exception after the first date is read.
org.bson.json.JsonParseException: JSON reader was expecting a value but found '}'.