Skip to content

Removing from an empty JsonObjectBuilder may produce a NPE #167

@apyjz-gh

Description

@apyjz-gh

It seems that builder does not initialize the valueMap field in all cases.

    public class Test {
        public static void main(String[] args) {
            JsonObjectBuilder builder = Json.createObjectBuilder();
            builder.remove("name");
        }
    }

Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.util.Map.remove(Object)" because "this.valueMap" is null
at org.eclipse.parsson.JsonObjectBuilderImpl.remove(JsonObjectBuilderImpl.java:171)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions