Uploaded image for project: 'Couchbase Lite'
  1. Couchbase Lite
  2. CBL-5455

Result.toJSON is annotated @NonNull, but can return null

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • Beryllium
    • 3.0
    • Java, Java-Android
    • Security Level: Public
    • None
    • 2

    Description

      If the Result contains illegal UTF-8 characters, the conversion from UTF-8 to UTF-16 in NativeFLEncoder_finishJSON will fail and return null and, thus, toJSON will return null.

      I believe that the correct solution to this is that toJSON (and, by extension Array and Dictionary) should throw exception on failure. This would be an API change.

      Currently these functions wrap the LiteCoreException thrown by LiteCore in an unchecked IllegalStateException.

      Attachments

        Activity

          People

            blake.meike Blake Meike
            blake.meike Blake Meike
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              PagerDuty