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

Nillable customizations ignore default rules for processing classes #39

Closed
m0mus opened this Issue Aug 30, 2017 · 1 comment

Comments

Projects
None yet
1 participant
@m0mus
Member

m0mus commented Aug 30, 2017

If JsonbNillable annotation is present on a class or jsonb engine is created with withNullValues(true) setting, private and static fields are present in the target JSON document with 'null' values regardless of the actual value they have. According to the spec, private and static fields must be ignored.

Sample:

@JsonbNillable
public class Person {
    private String name;
    private String profession;
    private String testField = "privateField";
    public static String staticField = "staticField";

    public Person() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getProfession() {
        return profession;
    }

    public void setProfession(String profession) {
        this.profession = profession;
    }
}

Result of serialization:

{
    "name": "Jason",
    "profession": "Argonauts Leader",
    "privateField": null,
    "staticField": null
}

@m0mus m0mus added the bug label Aug 30, 2017

@m0mus m0mus added this to the 1.0.1 milestone Aug 30, 2017

@m0mus m0mus self-assigned this Aug 30, 2017

m0mus added a commit that referenced this issue Aug 30, 2017

#39 - Fixed: nillable customizations ignore default rules for process…
…ing classes

Signed-off-by: Dmitry Kornilov <dmitry.kornilov@oracle.com>
@m0mus

This comment has been minimized.

Show comment
Hide comment
@m0mus

m0mus Aug 30, 2017

Member

Fixed.

Member

m0mus commented Aug 30, 2017

Fixed.

@m0mus m0mus closed this Aug 30, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment