Fixed Some Vulnerability Issues
[holmes/rule-management.git] / rulemgt / src / main / java / org / onap / holmes / rulemgt / bolt / enginebolt / EngineWrapper.java
index b0bd1f5..479437e 100644 (file)
@@ -1,5 +1,5 @@
 /**\r
- * Copyright 2017 ZTE Corporation.\r
+ * Copyright 2017-2020 ZTE Corporation.\r
  *\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
  */\r
 package org.onap.holmes.rulemgt.bolt.enginebolt;\r
 \r
-import com.alibaba.fastjson.JSON;\r
-import com.alibaba.fastjson.JSONObject;\r
-import javax.inject.Inject;\r
+import com.google.gson.JsonObject;\r
+import com.google.gson.JsonParser;\r
 import lombok.extern.slf4j.Slf4j;\r
 import org.apache.http.HttpResponse;\r
 import org.jvnet.hk2.annotations.Service;\r
+import org.onap.holmes.common.exception.CorrelationException;\r
 import org.onap.holmes.common.utils.HttpsUtils;\r
 import org.onap.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine;\r
 import org.onap.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine;\r
 import org.onap.holmes.rulemgt.constant.RuleMgtConstant;\r
-import org.onap.holmes.common.exception.CorrelationException;\r
+\r
+import javax.inject.Inject;\r
 \r
 @Service\r
 @Slf4j\r
@@ -44,9 +45,8 @@ public class EngineWrapper {
         if (response.getStatusLine().getStatusCode() == RuleMgtConstant.RESPONSE_STATUS_OK) {\r
             log.info("Succeeded in calling the rule deployment RESTful API from the engine management service.");\r
             try {\r
-               // JSONObject json = JSONObject.fromObject(HttpsUtils.extractResponseEntity(response));\r
-                JSONObject json=  JSON.parseObject(HttpsUtils.extractResponseEntity(response));\r
-                return json.get(RuleMgtConstant.PACKAGE).toString();\r
+                JsonObject json = JsonParser.parseString(HttpsUtils.extractResponseEntity(response)).getAsJsonObject();\r
+                return json.get(RuleMgtConstant.PACKAGE).getAsString();\r
             } catch (Exception e) {\r
                 throw new CorrelationException("Failed to parse the value returned by the engine management service.", e);\r
             }\r