org.bson.json.JsonParseException: JSON reader was expecting a value but found '}'.

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 3.5.0
    • Affects Version/s: 3.5.0
    • Component/s: JSON
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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 '}'.

              Assignee:
              Jeffrey Yemin
              Reporter:
              Michael Weber
              None
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: