Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2450

JsonReader in unable to read all base64 characters when creating BinData

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.5.0
    • Affects Version/s: 3.0.0
    • Component/s: JSON
    • 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:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            dkublik Dawid Kublik
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: