I have problem while deserializing javax.json.JsonObject
that is fetched from rest endpoint that returns javax.json.JsonObject
.
I'm using TomEE 7.0.2 web profile.
After little debugging, I found that exception coming from Johnzone JsonObject implementation, and it is NullPointerException
when using method JsonObject.getJsonObject(name)
.
From javadoc for JsonObject it saying that method should not throw exception if no mapping for name
is found. Insted it should return null
.
That Json deserialization is meant to be little generic, and sometimes not all mappings are present. And this is problem for me because JsonObject.getJsonObject(name)
is called in third party library.
Did I misunderstand something about why this NullPointerException
is thrown? Is there workround to use another javax.json.JsonObject
implementation when application war is run in TomEE server?
You can test the existance with containsKey before reading the actual value.