moip-sdk-java-le
moip-sdk-java-le copied to clipboard
fix(serialization): preventing NPE when Customer.moipAccount is null during serialization to String(Json)
Serialization with jackson fails when moipAccount field is null.
Kotlin code to reproduce the issue.
// all fields null(which is ok)
val c = Customer()
val objectMapper = ObjectMapper()
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL)
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
val json = objectMapper.writeValueAsString(c) // throws NPE, since it evaluates all fields.