summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2019-08-26 18:46:32 +0300
committerIttay Stern <ittay.stern@att.com>2019-08-26 18:46:32 +0300
commit5f20df6d207a9936d5140ddb7b7000fa8c3b521d (patch)
tree778edf814f6672518b547ff2c6faca588e049589
parented6c907de3578ee4dc79571753d7406da7685cee (diff)
Make Scheduler's client more Gennerics-tolerant
1. Use t.getClass, instead of new TypeReference<T>. The latter it not behaving as expected on run-time. 2. Store the raw response in restObject.setRaw (just because we can) Change-Id: Ic7087af18ded212447cb67334a9e373759f4da1f Issue-ID: VID-378 Signed-off-by: Ittay Stern <ittay.stern@att.com>
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/scheduler/SchedulerRestInterface.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/scheduler/SchedulerRestInterface.java b/vid-app-common/src/main/java/org/onap/vid/scheduler/SchedulerRestInterface.java
index 7878c2fb8..001a8ae6d 100644
--- a/vid-app-common/src/main/java/org/onap/vid/scheduler/SchedulerRestInterface.java
+++ b/vid-app-common/src/main/java/org/onap/vid/scheduler/SchedulerRestInterface.java
@@ -98,12 +98,13 @@ public class SchedulerRestInterface implements SchedulerRestInterfaceIfc {
status = response.getStatus();
restObject.setStatusCode(status);
rawData = response.getBody();
+ restObject.setRaw(rawData);
if (status == 200) {
if (t instanceof String) {
restObject.set((T)rawData);
}
else {
- restObject.set(JACKSON_OBJECT_MAPPER.readValue(rawData, new TypeReference<T>() {}));
+ restObject.set(JACKSON_OBJECT_MAPPER.readValue(rawData, (Class<T>)t.getClass()));
}
logger.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + SUCCESSFUL_API_MESSAGE);
logger.info(EELFLoggerDelegate.errorLogger, "<== " + methodName + SUCCESSFUL_API_MESSAGE);