Merge "logging requests and responses in SyncRestClient"
[vid.git] / vid-app-common / src / main / java / org / onap / vid / client / SyncRestClient.java
index f708756..5c65c8a 100644 (file)
@@ -21,8 +21,8 @@
 
 package org.onap.vid.client;
 
-import static org.apache.commons.lang3.StringUtils.isEmpty;
 import static org.onap.vid.client.UnirestPatchKt.patched;
+import static org.onap.vid.utils.KotlinUtilsKt.JOSHWORKS_JACKSON_OBJECT_MAPPER;
 
 import com.att.eelf.configuration.EELFLogger;
 import io.joshworks.restclient.http.HttpResponse;
@@ -250,27 +250,7 @@ public class SyncRestClient implements SyncRestClientInterface {
     }
 
     private ObjectMapper defaultObjectMapper() {
-        com.fasterxml.jackson.databind.ObjectMapper objectMapper = new com.fasterxml.jackson.databind.ObjectMapper();
-
-        return new ObjectMapper() {
-            @Override
-            public <T> T readValue(String value, Class<T> aClass) {
-                try {
-                    return isEmpty(value) ? null : objectMapper.readValue(value, aClass);
-                } catch (IOException e) {
-                    throw new SyncRestClientException("IOException while reading value", e);
-                }
-            }
-
-            @Override
-            public String writeValue(Object value) {
-                try {
-                    return objectMapper.writeValueAsString(value);
-                } catch (IOException e) {
-                    throw new SyncRestClientException("IOException while writing value", e);
-                }
-            }
-        };
+        return JOSHWORKS_JACKSON_OBJECT_MAPPER;
     }
 
     private CloseableHttpClient defaultHttpClient() {