flowable-engine icon indicating copy to clipboard operation
flowable-engine copied to clipboard

NullPointerException when saving response as JSON but the response returns no body

Open PeterCahn opened this issue 7 years ago • 1 comments

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().

PeterCahn avatar Feb 27 '19 11:02 PeterCahn

Closing issue as code pushed with test verification.

dbmalkovsky avatar May 10 '19 17:05 dbmalkovsky