From 5f20df6d207a9936d5140ddb7b7000fa8c3b521d Mon Sep 17 00:00:00 2001 From: Ittay Stern Date: Mon, 26 Aug 2019 18:46:32 +0300 Subject: Make Scheduler's client more Gennerics-tolerant 1. Use t.getClass, instead of new TypeReference. 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 --- .../src/main/java/org/onap/vid/scheduler/SchedulerRestInterface.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'vid-app-common/src/main/java') 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() {})); + restObject.set(JACKSON_OBJECT_MAPPER.readValue(rawData, (Class)t.getClass())); } logger.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + SUCCESSFUL_API_MESSAGE); logger.info(EELFLoggerDelegate.errorLogger, "<== " + methodName + SUCCESSFUL_API_MESSAGE); -- cgit 1.2.3-korg