summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common/src/main/java')
-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;