Test Replace Jackson with GSON
[holmes/common.git] / holmes-actions / src / main / java / org / onap / holmes / common / dmaap / Publisher.java
index 91e9d42..5c6965a 100644 (file)
@@ -15,8 +15,7 @@
  */\r
 package org.onap.holmes.common.dmaap;\r
 \r
-import com.fasterxml.jackson.core.JsonProcessingException;\r
-import com.fasterxml.jackson.databind.ObjectMapper;\r
+import com.alibaba.fastjson.JSON;\r
 import javax.ws.rs.client.Client;\r
 import javax.ws.rs.client.ClientBuilder;\r
 import javax.ws.rs.client.Entity;\r
@@ -43,14 +42,7 @@ public class Publisher {
 \r
     public boolean publish(PolicyMsg msg) throws CorrelationException {\r
         Client client = ClientBuilder.newClient(new ClientConfig());\r
-        ObjectMapper mapper = new ObjectMapper();\r
-        String content = null;\r
-        try {\r
-            content = mapper.writeValueAsString(msg);\r
-        } catch (JsonProcessingException e) {\r
-            throw new CorrelationException("Failed to convert the message object to a json string.",\r
-                    e);\r
-        }\r
+        String content = JSON.toJSONString(msg);\r
         WebTarget webTarget = client.target(url);\r
         Response response = null;\r
         try {\r