Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NPE caused by fields with WRITE_ONLY access #222

merged 1 commit into from
Feb 8, 2022


Copy link

@volomas volomas commented Jan 28, 2022

NullPointerException is thrown during insert when any field marked with
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY):

java.lang.NullPointerException at org.mongojack.internal.AnnotationHelper.hasIdAnnotation( at$getIdElementSerializationDescription$11( at java.base/$2$1.accept(

This happens because POJOPropertyBuilder::getPrimaryMember in case of serialization returns null when field is meant for deseriazliation only (according to WRITE_ONLY annotation)

Here is reproducer:

@rlodge rlodge merged commit cac8906 into mongojack:master Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants