flowable-engine
flowable-engine copied to clipboard
NullPointerException when saving response as JSON but the response returns no body
When in the Flowable Modeler the field "Save response as JSON" is set to true and the response has no body content (e.g. with the DELETE request method), a NullPointerException is thrown:
Caused by: java.lang.NullPointerException
at com.fasterxml.jackson.core.JsonFactory.createParser(JsonFactory.java:889) ~[jackson-core-2.9.8.jar:2.9.8]
at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:2551) ~[jackson-databind-2.9.8.jar:2.9.8]
at org.flowable.http.HttpActivityExecutor.execute(HttpActivityExecutor.java:117) ~[flowable-http-6.4.1.jar:6.4.1]
... 136 more
The error refers to HttpActivityExecutor.java:117:
Object varValue = request.isSaveResponseAsJson() ? objectMapper.readTree(response.getBody()) : response.getBody();
where response.getBody() returns null and pass it to readTree().
Closing issue as code pushed with test verification.