private String getResponseMessage(HttpClientException clientException) { try { StringBuilder builder = new StringBuilder(); RestResponse restResponse = ResourceDTOFactory.get(clientException.getMessage()); for (Message message : restResponse.getMessages()) { builder.append(message.toString()).append('\n'); } return builder.toString(); } catch (OpenShiftException e) { // unexpected json content LOGGER.error(e.getMessage()); return clientException.getMessage(); } catch (IllegalArgumentException e) { // not json return clientException.getMessage(); } }
protected <DTO> DTO getData(RestResponse response) { // in some cases, there is not response body, just a return code to // indicate that the operation was successful (e.g.: delete domain) if (response == null) { return null; } return response.getData(); }