[JAVA-2689] Type check the values in USE_GETTER_AS_SETTER_CONVENTION Created: 05/Dec/17  Updated: 20/Dec/17  Resolved: 20/Dec/17

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

Type: Improvement Priority: Major - P3
Reporter: Ross Lawley Assignee: Ross Lawley
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

There is a possibility for collections / maps to contain invalid pojos if there has been a bad data migration.

Test by decoding a collection / map that contains a pojo with a discriminator that does not match that of the expected pojo.



 Comments   
Comment by Ross Lawley [ 20/Dec/17 ]

Marking as "Won't Fix".

There is a possiblility when decoding to encounter invalid data - however that data will be handled by the codec that is responsible for the type of the field. So if there was invalid data in the collection, a PojoCodec would have handled that data, here two things can happen;

A) If the POJO is immutable then potentially it can't be constructed.
B) A POJO of the expected type is created and any default extra fields in the bson are ignored.

In terms of behaviour using the USE_GETTER_AS_SETTER_CONVENTION does not differ from the default behaviour.

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