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

Tighten validation of $uuid values in extended JSON

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.3.0
    • Affects Version/s: None
    • Component/s: JSON
    • None
    • Minor Change
    • Not Needed

      JsonReader uses UUID.fromString to parse values in $uuid extended JSON, e.g.

      {"_id" : { "$uuid" : "73ffd264-44b3-4c69-90e8-e7d1dfc035d4" }}
      

      However, UUID.fromString is more permissive in its parsing than what is strictly allowed by the grammar documented in UUID.toString. In particular, it doesn't require that the hypens appear in the write place. The result is that two otherwise identical strings that differ only in hyphen placement will parse to different and unequal UUID values.

      In scope of JAVA-3959, a spec test is being added for this case, and without tightening up the JsonReader parsing code, the driver fails the test.

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: