Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

fix(serialization): preventing NPE when Customer.moipAccount is null during serialization to String(Json) #131

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fzoro
Copy link

@fzoro fzoro commented Feb 25, 2019

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant