summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main
diff options
context:
space:
mode:
authorOfir Sonsino <ofir.sonsino@intl.att.com>2018-11-06 09:36:17 +0000
committerGerrit Code Review <gerrit@onap.org>2018-11-06 09:36:17 +0000
commitb34d9a76dec996e285a70baef39d501de9fd7bed (patch)
tree571cd23202e481ec46ec3eadf40ee4b4de36bf7c /vid-app-common/src/main
parent1ff7d1ac31d35819cea29671f5146cefcbe2cdf1 (diff)
parent0ff46010362eed22971dc462ba6b112c2aea78ec (diff)
Merge "Fix reading entity"
Diffstat (limited to 'vid-app-common/src/main')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java
index c1964c161..06e0f0174 100644
--- a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java
@@ -413,9 +413,7 @@ public class AaiClient implements AaiClientInterface {
} else {
logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "getSubscribers() resp=" + resp.getStatusInfo().toString());
if (resp.getStatus() != HttpStatus.SC_OK) {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "Invalid response from AAI");
- String rawData = resp.readEntity(String.class);
- subscriberDataResponse = new AaiResponse<>(null, rawData, resp.getStatus());
+ subscriberDataResponse = processFailureResponse(resp,responseBody);
} else {
subscriberDataResponse = processOkResponse(resp, classType, responseBody, omType, propagateExceptions);
}
@@ -423,6 +421,17 @@ public class AaiClient implements AaiClientInterface {
return subscriberDataResponse;
}
+ private AaiResponse processFailureResponse(Response resp, String responseBody) {
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "Invalid response from AAI");
+ String rawData;
+ if (responseBody != null) {
+ rawData = responseBody;
+ } else {
+ rawData = resp.readEntity(String.class);
+ }
+ return new AaiResponse<>(null, rawData, resp.getStatus());
+ }
+
private AaiResponse processOkResponse(Response resp, Class classType, String responseBody, VidObjectMapperType omType, boolean propagateExceptions) {
AaiResponse subscriberDataResponse;
String finalResponse = null;