private void checkStatus(ODataResponse response, int expectedStatusCode) throws CMODataClientException { if (response.getStatusCode() != expectedStatusCode) { IOException suspressed = null; String bodyContent = "<n/a>"; try { /* * Does not work for http-4xx and http.5xx since Olingo prefers to answer * with an exception in this case rather with an response entity. But it might * be helpful also for inexpected http responses outside that range. */ bodyContent = IOUtils.toString(response.getRawResponse()); } catch(IOException e) { suspressed = e; logger.warn("Cannot read response body content.", e); } CMODataClientException e = new CMODataClientException( format("Response status code '%d' does not match expected status code '%d'. Response body: '%s'.", response.getStatusCode(), expectedStatusCode, bodyContent)); if(suspressed != null) e.addSuppressed(suspressed); throw e; } }
private void checkStatus(ODataResponse response, int expectedStatusCode) throws CMODataClientException { if (response.getStatusCode() != expectedStatusCode) { IOException suspressed = null; String bodyContent = "<n/a>"; try { /* * Does not work for http-4xx and http.5xx since Olingo prefers to answer * with an exception in this case rather with an response entity. But it might * be helpful also for inexpected http responses outside that range. */ bodyContent = IOUtils.toString(response.getRawResponse()); } catch(IOException e) { suspressed = e; logger.warn("Cannot read response body content.", e); } CMODataClientException e = new CMODataClientException( format("Response status code '%d' does not match expected status code '%d'. Response body: '%s'.", response.getStatusCode(), expectedStatusCode, bodyContent)); if(suspressed != null) e.addSuppressed(suspressed); throw e; } }
service.getClient(), new ResponseStatusLine(res), res.getRawResponse(), ((ODataRequest) request).getAccept()), index, requests.get(index))); if (!service.getClient().getConfiguration().isContinueOnError()) {
service.getClient(), new ResponseStatusLine(res), res.getRawResponse(), ((ODataRequest) request).getAccept()), index, requests.get(index))); if (!service.getClient().getConfiguration().isContinueOnError()) {