Rescoping to provide meaningful error messages when data is found for a field that does not match the expected type.
Rather than throwing a generic error:
org.bson.BsonInvalidOperationException: readBoolean can only be called when CurrentBSONType is BOOLEAN, not when CurrentBSONType is NULL.
Wrap the exception and also provide information on what the name of the field that failed.
Was:
Determine handling of null values when decoding back in to primitive types
When decoding in to Java objects with primitives, we need to decide if we're going to actively set those primitives to their 0 values or not set the field at all let any initialization in the class take care of it.
- is duplicated by
-
JAVA-2219 Determine handling of default values
- Closed