diff options
4 files changed, 18 insertions, 15 deletions
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientConnector.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientConnector.java index f031f10bb5..652df6ff0d 100644 --- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientConnector.java +++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientConnector.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,7 +20,7 @@ package org.onap.so.cloudify.base.client; - +@FunctionalInterface public interface CloudifyClientConnector { public <T> CloudifyResponse request(CloudifyRequest<T> request); diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseException.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseException.java index 966cc8f144..0ca3212238 100644 --- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseException.java +++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseException.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,11 +26,11 @@ public class CloudifyResponseException extends CloudifyBaseException { private static final long serialVersionUID = 7294957362769575271L; - protected String message; - protected int status; + private final String message; + private final int status; // Make the response available for exception handling (includes body) - protected CloudifyResponse response; + private final CloudifyResponse response; public CloudifyResponseException(String message, int status) { this.message = message; diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java index ba6a5911b7..54519bac72 100644 --- a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java +++ b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java @@ -9,9 +9,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -94,7 +94,7 @@ public class HttpClientConnector implements CloudifyClientConnector { public <T> CloudifyResponse request(CloudifyRequest<T> request) { - CloseableHttpClient httpClient = null; // HttpClients.createDefault(); + CloseableHttpClient httpClient = null; if (request.isBasicAuth()) { // Use Basic Auth for this request. @@ -211,11 +211,14 @@ public class HttpClientConnector implements CloudifyClientConnector { } catch (HttpResponseException e) { // What exactly does this mean? It does not appear to get thrown for // non-2XX responses as documented. + logger.error("Client HttpResponseException", e); throw new CloudifyResponseException(e.getMessage(), e.getStatusCode()); } catch (UnknownHostException e) { + logger.error("Client UnknownHostException", e); throw new CloudifyConnectException("Unknown Host: " + e.getMessage()); } catch (IOException e) { // Catch all other IOExceptions and throw as OpenStackConnectException + logger.error("Client IOException", e); throw new CloudifyConnectException(e.getMessage()); } catch (Exception e) { // Catchall for anything else, must throw as a RuntimeException @@ -227,7 +230,7 @@ public class HttpClientConnector implements CloudifyClientConnector { try { httpResponse.close(); } catch (IOException e) { - logger.debug("Unable to close HTTP Response: " + e); + logger.debug("Unable to close HTTP Response: ", e); } } diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java index a96fdb6b50..f1aa06cb39 100644 --- a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java +++ b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java @@ -9,9 +9,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -39,7 +39,7 @@ public class HttpClientResponse implements CloudifyResponse { private static Logger logger = LoggerFactory.getLogger(HttpClientResponse.class); - private HttpResponse response = null; + private transient HttpResponse response = null; private String entityBody = null; public HttpClientResponse(HttpResponse response) { |