fix: handle cases when record is updated and no...
... content is returned
Salesforce returns HTTP status 204 - No Content, in that case we cannot
deserialize the body to CreateSObjectResult.
@@ -73,10 +73,12 @@ public class SalesforceUpsertSObjectComponent extends DefaultConnectorComponent
final ObjectMapper mapper = JsonUtils.createObjectMapper();
if (!exchange.isFailed()) {
final Message out = exchange.getOut();
- final CreateSObjectResult result = mapper.readValue(out.getBody(String.class),
- CreateSObjectResult.class);
+ final String body = out.getBody(String.class);
+ if (body != null) {
+ final CreateSObjectResult result = mapper.readValue(body, CreateSObjectResult.class);
out.setBody(result);
}
+ }
});
}
