diff options
author | 2019-08-26 18:46:32 +0300 | |
---|---|---|
committer | 2019-08-26 18:46:32 +0300 | |
commit | 5f20df6d207a9936d5140ddb7b7000fa8c3b521d (patch) | |
tree | 778edf814f6672518b547ff2c6faca588e049589 /vid-app-common/src/main | |
parent | ed6c907de3578ee4dc79571753d7406da7685cee (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>
Diffstat (limited to 'vid-app-common/src/main')
-rw-r--r-- | vid-app-common/src/main/java/org/onap/vid/scheduler/SchedulerRestInterface.java | 3 |
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); |