HELIUM: toJSON should throw unchecked exception

Description

The toJSON methods in Array, Dictionary, Result and Document should all throw an unchecked exception if they fail because some string cannot be translated from UTF-8 (Fleece) encoding, to UTF-16 (Java String encoding)

The exception is unchecked in the 3.1 branch ONLY. This avoids changing the API.

Currently all except Document are annotated as @NonNull, when, in fact, they can return null. Document is annotated as @Nullable and should stay that way. All the others should be annotated @NonNull (not a breaking change) but changed to throw an IllegalStateException

is a backport of

Activity

Show:

CB robot April 24, 2024 at 8:21 PM

Build couchbase-lite-android-3.1.7-3 contains couchbase-lite-java-common commit bcb0f1d with commit message:
: toJSON should throw unchecked exception (#274)

CB robot April 24, 2024 at 8:20 PM

Build couchbase-lite-java-3.1.7-3 contains couchbase-lite-java-common commit bcb0f1d with commit message:
: toJSON should throw unchecked exception (#274)

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Story Points

Fix versions

Affects versions

Priority

Instabug

Open Instabug

PagerDuty

Sentry

Zendesk Support

Created April 19, 2024 at 5:45 PM
Updated April 24, 2024 at 8:21 PM
Resolved April 23, 2024 at 11:29 PM
Instabug