Exception in thread "main" java.lang.NullPointerException
at com.theoryinpractise.halbuilder5.json.JsonRepresentationWriter.renderJsonProperties(JsonRepresentationWriter.java:159)
at com.theoryinpractise.halbuilder5.json.JsonRepresentationWriter.renderJson(JsonRepresentationWriter.java:104)
at com.theoryinpractise.halbuilder5.json.JsonRepresentationWriter.write(JsonRepresentationWriter.java:66)
at com.theoryinpractise.halbuilder5.json.JsonRepresentationWriter.print(JsonRepresentationWriter.java:60)
since the corresponding JsonNode is NULL in renderJsonProperties(). A NULL check before JsonRepresentationWriter.java:159 seems to fix the problem. It's not a big issue though since you can easily work around by using
ResourceRepresentation.create( new HashMap<>() )
instead of
ResourceRepresentation.empty()
but since empty() exists it should not throw an NPE.
Hi,
This issue applies to v5.0.1, 5.0.2-SNAPSHOT (and the current "develop" branch).
Representations with empty value produce an NPE:
results in
since the corresponding
JsonNode
isNULL
inrenderJsonProperties()
. ANULL
check before JsonRepresentationWriter.java:159 seems to fix the problem. It's not a big issue though since you can easily work around by usinginstead of
but since
empty()
exists it should not throw an NPE.Regards, Markus