eclipse-ee4j / eclipse-ee4j/parsson

Removing from an empty JsonObjectBuilder may produce a NPE

Open
#167 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
17
Forks
25
PR merge metrics
No merged PRs in 30d

Description

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)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.