Skip to content

Commit

Permalink
Merge d891456 into 39d5a93
Browse files Browse the repository at this point in the history
  • Loading branch information
James Richard committed Apr 30, 2020
2 parents 39d5a93 + d891456 commit 44a689f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
import com.synopsys.integration.rest.exception.IntegrationRestException;
import com.synopsys.integration.rest.proxy.ProxyInfo;
import com.synopsys.integration.rest.request.Request;
import com.synopsys.integration.rest.response.Response;
import com.synopsys.integration.rest.response.ErrorResponse;
import com.synopsys.integration.rest.response.Response;

/**
* A basic, extendable http client.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
Expand Down Expand Up @@ -78,6 +80,9 @@ public <C extends IntRestComponent> C getComponentAs(String json, Type responseT

public <C extends IntRestComponent> C getComponentAs(JsonObject jsonObject, Type responseType) throws IntegrationException {
final String json = gson.toJson(jsonObject);
if (null == jsonObject || StringUtils.isBlank(json)) {
throw new IntegrationException(String.format("The server did not have a response body. Can not convert the response to '%s'", responseType.getTypeName()));
}
try {
addJsonAsField(jsonObject);
C transformedResponse = gson.fromJson(jsonObject, responseType);
Expand Down

0 comments on commit 44a689f

Please sign in to comment.