diff options
Diffstat (limited to 'controlloop/common/model-impl')
-rw-r--r-- | controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOManager.java | 8 | ||||
-rw-r--r-- | controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java | 17 |
2 files changed, 16 insertions, 9 deletions
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOManager.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOManager.java index 81d43ef76..9f4fe5bbc 100644 --- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOManager.java +++ b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOManager.java @@ -87,8 +87,12 @@ public final class MSOManager { } Thread.sleep(20000); } - - System.out.println("***** ######## VF Module Creation timeout. Status: ("+responseGet.request.requestStatus.requestState+")"); + if (responseGet != null + && responseGet.request != null + && responseGet.request.requestStatus != null + && responseGet.request.requestStatus.requestState != null) { + logger.warn("***** ######## VF Module Creation timeout. Status: ( {})", responseGet.request.requestStatus.requestState); + } return responseGet; } catch (JsonSyntaxException e) { logger.error("Failed to deserialize into MSOResponse: ", e); diff --git a/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java b/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java index 8c79d2ad3..c38c1076c 100644 --- a/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java +++ b/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java @@ -67,8 +67,10 @@ public final class RESTManager { try (CloseableHttpClient client = HttpClientBuilder.create().setDefaultCredentialsProvider(credentials).build()) { HttpPost post = new HttpPost(url); - for (String key : headers.keySet()) { - post.addHeader(key, headers.get(key)); + if (headers != null) { + for (String key : headers.keySet()) { + post.addHeader(key, headers.get(key)); + } } post.addHeader("Content-Type", contentType); @@ -100,16 +102,17 @@ public final class RESTManager { try (CloseableHttpClient client = HttpClientBuilder.create().setDefaultCredentialsProvider(credentials).build()) { HttpGet get = new HttpGet(url); - for (String key : headers.keySet()) { - get.addHeader(key, headers.get(key)); + if (headers != null) { + for (String key : headers.keySet()) { + get.addHeader(key, headers.get(key)); + } } HttpResponse response = client.execute(get); String returnBody = EntityUtils.toString(response.getEntity(), "UTF-8"); - System.out.println("HTTP GET Response Status Code: " + response.getStatusLine().getStatusCode()); - System.out.println("HTTP GET Response Body:"); - System.out.println(returnBody); + logger.debug("HTTP GET Response Status Code: " + response.getStatusLine().getStatusCode()); + logger.debug("HTTP GET Response Body: " + returnBody); return new Pair<Integer, String>(response.getStatusLine().getStatusCode(), returnBody); } catch (IOException e) { |