Story #7832: migrate from JibX to JAXB for XML binding / codegen
schema validation behavior
unmarshalling objects using JAXB (without schema validation) can lead to changes in the values. For example, an invalid date leaves the corresponding Date property as null, instead of throwing an exception. I don't know what JiBX did in this situation.
Duplicate "identifier" fields in the systemMetadata, for example, doesn't cause problems - one of the identifier values is simply ignored.
Is this ok, or should we be schema validating when we unmarshal? How much did JiBX catch and alert us to in the past? there were no unit tests dedicated to this issue.
#1 Updated by Rob Nahf over 4 years ago
TypeMarshaller currently validates upon marshalling (by default - there's a property setting to control this) but not on unmarshalling. validation on marshalling was added to mimic the JiBX behavior.
TypeMarshaller is the place to add it. This looks like a decent how-to: https://docs.oracle.com/cd/E19575-01/819-3669/bnbbc/index.html