InputStreamReader reader = null;
try {
reader = new InputStreamReader(entity.getContent(), contentType.getCharset());
CoverallsResponse cr = objectMapper.readValue(reader, CoverallsResponse.class);
if (cr.isError()) {
throw new ProcessingException(getResponseErrorMessage(response, cr.getMessage()));
}
return cr;
} catch (JsonProcessingException ex) {
throw new ProcessingException(getResponseErrorMessage(response, ex.getMessage()), ex);
} catch (IOException ex) {
throw new IOException(getResponseErrorMessage(response, ex.getMessage()), ex);
} finally {
IOUtil.close(reader);
}