[JAVA-2215] Determine handling of null values when decoding back in to primitive types Created: 09/Jun/16  Updated: 03/Apr/17  Resolved: 03/Apr/17

Status: Closed
Project: Java Driver
Component/s: Codecs
Affects Version/s: None
Fix Version/s: 3.5.0

Type: Improvement Priority: Major - P3
Reporter: Justin Lee Assignee: Ross Lawley
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by JAVA-2219 Determine handling of default values Closed
Epic Link: POJO

 Description   

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.



 Comments   
Comment by Ross Lawley [ 03/Apr/17 ]

See JAVA-1812 for the commit containing the commit covering this ticket.

Comment by Ross Lawley [ 03/Feb/17 ]

Will look at in the scope of JAVA-2219

Generated at Thu Feb 08 08:56:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.