JsonReader in unable to read all base64 characters when creating BinData

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Minor - P4
    • 3.5.0
    • Affects Version/s: 3.0.0
    • Component/s: JSON
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Issue

      Currently *org.bson.json.JsonReader *in unable to read all base64 characters when creating BinData
      Troublesome characters:* '+', '/', '='*

      This makes for example org.bson.Document.parse(final String json) fail when reading documents with binary uuids.

      To reproduce:

      *in org.bson.json.JsonReaderTest.testBinDataWithNew() *
      replace
      `String json = "

      { \"a\" : new BinData(3, AQID) }

      ";`

      with
      `String json = "

      { \"a\" : new BinData(3, AQIDBA==) }

      ";`

      to get new byte[]

      {1, 2, 3, 4}

      it will fail as BinDataConstructor expects only unquotted string as byte value and
      org.bson.json.JsonScanner.scanUnquotedString()
      reads only '$', '_', letters and digits

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

                Created:
                Updated:
                Resolved: