You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tubemq.apache.org by os...@apache.org on 2020/04/02 06:44:44 UTC

[incubator-tubemq] branch master updated: [TUBEMQ-50] Replace fastjson to gson (#43)

This is an automated email from the ASF dual-hosted git repository.

osgooli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tubemq.git


The following commit(s) were added to refs/heads/master by this push:
     new 332edc4  [TUBEMQ-50] Replace fastjson to gson (#43)
332edc4 is described below

commit 332edc43a6e328eb514e9d2809bdde79a1edc077
Author: gosonzhang <46...@qq.com>
AuthorDate: Thu Apr 2 14:44:35 2020 +0800

    [TUBEMQ-50] Replace fastjson to gson (#43)
    
    Co-authored-by: gosonzhang <go...@tencent.com>
---
 LICENSE                                            |  4 +-
 pom.xml                                            |  7 +-
 tubemq-core/pom.xml                                |  4 +-
 .../corebase/policies/FlowCtrlRuleHandler.java     | 97 +++++++++++-----------
 .../server/common/utils/WebParameterUtils.java     | 67 +++++++--------
 .../web/handler/WebAdminGroupCtrlHandler.java      | 20 ++---
 .../web/handler/WebAdminTopicAuthHandler.java      | 14 ++--
 .../web/handler/WebBrokerDefConfHandler.java       |  4 +-
 .../web/handler/WebBrokerTopicConfHandler.java     |  4 +-
 9 files changed, 111 insertions(+), 110 deletions(-)

diff --git a/LICENSE b/LICENSE
index 4ec29da..ff689ee 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1317,8 +1317,8 @@ Copyright 2002-2019 The Apache Software Foundation
 Copyright (C) 2002 Kevin Atkinson (kevina@gnu.org)
 Copyright (c) 2008 Alexander Beider & Stephen P. Morse.
 
-5. fastjson 1.2.60
-Copyright 1999-2019 Alibaba Group Holding Ltd.
+5. gson 2.8.5
+Copyright 2008 Google Inc.
 
 6. commons-lang 2.6
 Copyright 2001-2011 The Apache Software Foundation
diff --git a/pom.xml b/pom.xml
index daffad3..e78f3b4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,6 +76,7 @@
         <checkstyle.version>6.19</checkstyle.version>
         <protobuf.version>2.5.0</protobuf.version>
         <je.version>7.3.7</je.version>
+        <gson.version>2.8.5</gson.version>
     </properties>
 
     <repositories>
@@ -281,9 +282,9 @@
                 <version>${je.version}</version>
             </dependency>
             <dependency>
-                <groupId>com.alibaba</groupId>
-                <artifactId>fastjson</artifactId>
-                <version>1.2.60</version>
+                <groupId>com.google.code.gson</groupId>
+                <artifactId>gson</artifactId>
+                <version>${gson.version}</version>
             </dependency>
             <dependency>
                 <groupId>commons-lang</groupId>
diff --git a/tubemq-core/pom.xml b/tubemq-core/pom.xml
index 7e8e5dc..cdaeb41 100644
--- a/tubemq-core/pom.xml
+++ b/tubemq-core/pom.xml
@@ -77,8 +77,8 @@
             <artifactId>netty</artifactId>
         </dependency>
         <dependency>
-            <groupId>com.alibaba</groupId>
-            <artifactId>fastjson</artifactId>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
         </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>
diff --git a/tubemq-core/src/main/java/org/apache/tubemq/corebase/policies/FlowCtrlRuleHandler.java b/tubemq-core/src/main/java/org/apache/tubemq/corebase/policies/FlowCtrlRuleHandler.java
index 3811331..0f0653c 100644
--- a/tubemq-core/src/main/java/org/apache/tubemq/corebase/policies/FlowCtrlRuleHandler.java
+++ b/tubemq-core/src/main/java/org/apache/tubemq/corebase/policies/FlowCtrlRuleHandler.java
@@ -17,9 +17,9 @@
 
 package org.apache.tubemq.corebase.policies;
 
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Collections;
@@ -47,6 +47,7 @@ public class FlowCtrlRuleHandler {
     private final String flowCtrlName;
     private static final Logger logger =
             LoggerFactory.getLogger(FlowCtrlRuleHandler.class);
+    private final JsonParser jsonParser = new JsonParser();
     private final TimeZone timeZone = TimeZone.getTimeZone("GMT+8:00");
     private final ReentrantLock writeLock = new ReentrantLock();
     // Flow control ID and string information obtained from the server
@@ -400,9 +401,9 @@ public class FlowCtrlRuleHandler {
         if (TStringUtils.isBlank(flowCtrlInfo)) {
             throw new Exception("Parsing error, flowCtrlInfo value is blank!");
         }
-        JSONArray objArray = null;
+        JsonArray objArray = null;
         try {
-            objArray = JSON.parseArray(flowCtrlInfo);
+            objArray = jsonParser.parse(flowCtrlInfo).getAsJsonArray();
         } catch (Throwable e1) {
             throw new Exception("Parse flowCtrlInfo value failure", e1);
         }
@@ -415,8 +416,8 @@ public class FlowCtrlRuleHandler {
         try {
             List<FlowCtrlItem> flowCtrlItemList;
             for (int i = 0; i < objArray.size(); i++) {
-                JSONObject jsonObject = objArray.getJSONObject(i);
-                int typeVal = jsonObject.getIntValue("type");
+                JsonObject jsonObject = objArray.get(i).getAsJsonObject();
+                int typeVal = jsonObject.get("type").getAsInt();
                 if (typeVal < 0 || typeVal > 3) {
                     throw new Exception(new StringBuilder(512)
                             .append("type value must in [0,1,2,3] in index(")
@@ -461,55 +462,55 @@ public class FlowCtrlRuleHandler {
      * @return
      * @throws Exception
      */
-    private List<FlowCtrlItem> parseDataLimit(int typeVal, JSONObject jsonObject) throws Exception {
-        if (jsonObject == null || jsonObject.getIntValue("type") != 0) {
+    private List<FlowCtrlItem> parseDataLimit(int typeVal, JsonObject jsonObject) throws Exception {
+        if (jsonObject == null || jsonObject.get("type").getAsInt() != 0) {
             throw new Exception("parse data limit rule failure!");
         }
-        JSONArray ruleArray = jsonObject.getJSONArray("rule");
+        JsonArray ruleArray = jsonObject.get("rule").getAsJsonArray();
         if (ruleArray == null) {
             throw new Exception("not found rule list in data limit!");
         }
         ArrayList<FlowCtrlItem> flowCtrlItems = new ArrayList<FlowCtrlItem>();
         for (int index = 0; index < ruleArray.size(); index++) {
-            JSONObject ruleObject = ruleArray.getJSONObject(index);
+            JsonObject ruleObject = ruleArray.get(index).getAsJsonObject();
             int startTime = validAndGetTimeValue("start",
-                    ruleObject.getString("start"), index, "data");
+                    ruleObject.get("start").getAsString(), index, "data");
             int endTime = validAndGetTimeValue("end",
-                    ruleObject.getString("end"), index, "data");
+                    ruleObject.get("end").getAsString(), index, "data");
             if (startTime >= endTime) {
                 throw new Exception(new StringBuilder(512)
                         .append("start value must lower than the End value in index(")
                         .append(index).append(") of data limit rule!").toString());
             }
-            if (!ruleObject.containsKey("dltInM")) {
+            if (!ruleObject.has("dltInM")) {
                 throw new Exception(new StringBuilder(512)
                         .append("dltInM key is required in index(")
                         .append(index).append(") of data limit rule!").toString());
             }
-            long dltVal = ruleObject.getLong("dltInM");
+            long dltVal = ruleObject.get("dltInM").getAsLong();
             if (dltVal <= 20) {
                 throw new Exception(new StringBuilder(512)
                         .append("dltInM value must be greater than 20 in index(")
                         .append(index).append(") of data limit rule!").toString());
             }
-            if (!ruleObject.containsKey("limitInM")) {
+            if (!ruleObject.has("limitInM")) {
                 throw new Exception(new StringBuilder(512)
                         .append("limitInM key is required in index(")
                         .append(index).append(") of data limit rule!").toString());
             }
-            long dataLimitInM = ruleObject.getLong("limitInM");
+            long dataLimitInM = ruleObject.get("limitInM").getAsLong();
             if (dataLimitInM < 0) {
                 throw new Exception(new StringBuilder(512)
                         .append("limitInM value must be greater than or equal to zero in index(")
                         .append(index).append(") of data limit rule!").toString());
             }
             dataLimitInM = dataLimitInM * 1024 * 1024;
-            if (!ruleObject.containsKey("freqInMs")) {
+            if (!ruleObject.has("freqInMs")) {
                 throw new Exception(new StringBuilder(512)
                         .append("freqInMs key is required in index(")
                         .append(index).append(") of data limit rule!").toString());
             }
-            int freqInMs = ruleObject.getIntValue("freqInMs");
+            int freqInMs = ruleObject.get("freqInMs").getAsInt();
             if (freqInMs < 200) {
                 throw new Exception(new StringBuilder(512)
                         .append("freqInMs value must be greater than or equal to 200 in index(")
@@ -541,34 +542,34 @@ public class FlowCtrlRuleHandler {
      * @throws Exception
      */
     private List<FlowCtrlItem> parseFreqLimit(int typeVal,
-                                              JSONObject jsonObject) throws Exception {
-        if (jsonObject == null || jsonObject.getIntValue("type") != 1) {
+                                              JsonObject jsonObject) throws Exception {
+        if (jsonObject == null || jsonObject.get("type").getAsInt() != 1) {
             throw new Exception("parse freq limit rule failure!");
         }
-        JSONArray ruleArray = jsonObject.getJSONArray("rule");
+        JsonArray ruleArray = jsonObject.get("rule").getAsJsonArray();
         if (ruleArray == null) {
             throw new Exception("not found rule list in freq limit!");
         }
         ArrayList<FlowCtrlItem> flowCtrlItems = new ArrayList<FlowCtrlItem>();
         for (int index = 0; index < ruleArray.size(); index++) {
-            JSONObject ruleObject = ruleArray.getJSONObject(index);
-            if (!ruleObject.containsKey("zeroCnt")) {
+            JsonObject ruleObject = ruleArray.get(index).getAsJsonObject();
+            if (!ruleObject.has("zeroCnt")) {
                 throw new Exception(new StringBuilder(512)
                         .append("zeroCnt key is required in index(")
                         .append(index).append(") of freq limit rule!").toString());
             }
-            int zeroCnt = ruleObject.getIntValue("zeroCnt");
+            int zeroCnt = ruleObject.get("zeroCnt").getAsInt();
             if (zeroCnt < 1) {
                 throw new Exception(new StringBuilder(512)
                         .append("zeroCnt value must be greater than or equal to 1 in index(")
                         .append(index).append(") of freq limit rule!").toString());
             }
-            if (!ruleObject.containsKey("freqInMs")) {
+            if (!ruleObject.has("freqInMs")) {
                 throw new Exception(new StringBuilder(512)
                         .append("freqInMs key is required in index(")
                         .append(index).append(") of freq limit rule!").toString());
             }
-            int freqInMs = ruleObject.getIntValue("freqInMs");
+            int freqInMs = ruleObject.get("freqInMs").getAsInt();
             if (freqInMs < 0) {
                 throw new Exception(new StringBuilder(512)
                         .append("freqInMs value must be greater than or equal to zero in index(")
@@ -599,11 +600,11 @@ public class FlowCtrlRuleHandler {
      * @throws Exception
      */
     private List<FlowCtrlItem> parseLowFetchLimit(int typeVal,
-                                                  JSONObject jsonObject) throws Exception {
-        if (jsonObject == null || jsonObject.getIntValue("type") != 3) {
+                                                  JsonObject jsonObject) throws Exception {
+        if (jsonObject == null || jsonObject.get("type").getAsInt() != 3) {
             throw new Exception("parse low fetch limit rule failure!");
         }
-        JSONArray ruleArray = jsonObject.getJSONArray("rule");
+        JsonArray ruleArray = jsonObject.get("rule").getAsJsonArray();
         if (ruleArray == null) {
             throw new Exception("not found rule list in low fetch limit!");
         }
@@ -612,24 +613,24 @@ public class FlowCtrlRuleHandler {
         }
         ArrayList<FlowCtrlItem> flowCtrlItems = new ArrayList<FlowCtrlItem>();
         for (int index = 0; index < ruleArray.size(); index++) {
-            JSONObject ruleObject = ruleArray.getJSONObject(index);
+            JsonObject ruleObject = ruleArray.get(index).getAsJsonObject();
             int normfreqInMs = 0;
             int filterFreqInMs = 0;
             int minDataFilterFreqInMs = 0;
-            if (ruleObject.containsKey("filterFreqInMs")
-                    || ruleObject.containsKey("minDataFilterFreqInMs")) {
-                filterFreqInMs = ruleObject.getIntValue("filterFreqInMs");
+            if (ruleObject.has("filterFreqInMs")
+                    || ruleObject.has("minDataFilterFreqInMs")) {
+                filterFreqInMs = ruleObject.get("filterFreqInMs").getAsInt();
                 if (filterFreqInMs < 0 || filterFreqInMs > 300000) {
                     throw new Exception(new StringBuilder(512)
                             .append("filterFreqInMs value must in [0, 300000] in index(")
                             .append(index).append(") of low fetch limit rule!").toString());
                 }
-                if (!ruleObject.containsKey("minDataFilterFreqInMs")) {
+                if (!ruleObject.has("minDataFilterFreqInMs")) {
                     throw new Exception(new StringBuilder(512)
                             .append("minDataFilterFreqInMs key is required in index(")
                             .append(index).append(") of low fetch limit rule!").toString());
                 }
-                minDataFilterFreqInMs = ruleObject.getIntValue("minDataFilterFreqInMs");
+                minDataFilterFreqInMs = ruleObject.get("minDataFilterFreqInMs").getAsInt();
                 if (minDataFilterFreqInMs < 0 || minDataFilterFreqInMs > 300000) {
                     throw new Exception(new StringBuilder(512)
                             .append("minDataFilterFreqInMs value must in [0, 300000] in index(")
@@ -642,8 +643,8 @@ public class FlowCtrlRuleHandler {
                             .append(index).append(") of low fetch limit rule!").toString());
                 }
             }
-            if (ruleObject.containsKey("normFreqInMs")) {
-                normfreqInMs = ruleObject.getIntValue("normFreqInMs");
+            if (ruleObject.has("normFreqInMs")) {
+                normfreqInMs = ruleObject.get("normFreqInMs").getAsInt();
                 if (normfreqInMs < 0 || normfreqInMs > 300000) {
                     throw new Exception(new StringBuilder(512)
                             .append("normFreqInMs value must in [0, 300000] in index(")
@@ -676,43 +677,43 @@ public class FlowCtrlRuleHandler {
      * @throws Exception
      */
     private List<FlowCtrlItem> parseSSDProcLimit(int typeVal,
-                                                 JSONObject jsonObject) throws Exception {
-        if (jsonObject == null || jsonObject.getIntValue("type") != 2) {
+                                                 JsonObject jsonObject) throws Exception {
+        if (jsonObject == null || jsonObject.get("type").getAsInt() != 2) {
             throw new Exception("parse SSD limit rule failure!");
         }
-        JSONArray ruleArray = jsonObject.getJSONArray("rule");
+        JsonArray ruleArray = jsonObject.get("rule").getAsJsonArray();
         if (ruleArray == null) {
             throw new Exception("not found rule list in SSD limit!");
         }
         ArrayList<FlowCtrlItem> flowCtrlItems = new ArrayList<FlowCtrlItem>();
         for (int index = 0; index < ruleArray.size(); index++) {
-            JSONObject ruleObject = ruleArray.getJSONObject(index);
+            JsonObject ruleObject = ruleArray.get(index).getAsJsonObject();
             int startTime = validAndGetTimeValue("start",
-                    ruleObject.getString("start"), index, "SSD");
+                    ruleObject.get("start").getAsString(), index, "SSD");
             int endTime = validAndGetTimeValue("end",
-                    ruleObject.getString("end"), index, "SSD");
+                    ruleObject.get("end").getAsString(), index, "SSD");
             if (startTime >= endTime) {
                 throw new Exception(new StringBuilder(512)
                         .append("start value must be less than End value in index(")
                         .append(index).append(") of SSD limit rule!").toString());
             }
-            if (!ruleObject.containsKey("dltStInM")) {
+            if (!ruleObject.has("dltStInM")) {
                 throw new Exception(new StringBuilder(512)
                         .append("dltStInM key is required in index(")
                         .append(index).append(") of SSD limit rule!").toString());
             }
-            long dltStInM = ruleObject.getLong("dltStInM");
+            long dltStInM = ruleObject.get("dltStInM").getAsLong();
             if (dltStInM < 512) {
                 throw new Exception(new StringBuilder(512)
                         .append("dltStInM value must be greater than or equal to 512 in index(")
                         .append(index).append(") of SSD limit rule!").toString());
             }
-            if (!ruleObject.containsKey("dltEdInM")) {
+            if (!ruleObject.has("dltEdInM")) {
                 throw new Exception(new StringBuilder(512)
                         .append("dltEdInM key is required in index(")
                         .append(index).append(") of SSD limit rule!").toString());
             }
-            long dataEndInM = ruleObject.getLong("dltEdInM");
+            long dataEndInM = ruleObject.get("dltEdInM").getAsLong();
             if (dataEndInM < 0) {
                 throw new Exception(new StringBuilder(512)
                         .append("dltEdInM value must be greater than or equal to zero in index(")
diff --git a/tubemq-server/src/main/java/org/apache/tubemq/server/common/utils/WebParameterUtils.java b/tubemq-server/src/main/java/org/apache/tubemq/server/common/utils/WebParameterUtils.java
index 3e9853a..841c6a6 100644
--- a/tubemq-server/src/main/java/org/apache/tubemq/server/common/utils/WebParameterUtils.java
+++ b/tubemq-server/src/main/java/org/apache/tubemq/server/common/utils/WebParameterUtils.java
@@ -17,8 +17,8 @@
 
 package org.apache.tubemq.server.common.utils;
 
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.TypeReference;
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import java.text.DateFormat;
@@ -56,7 +56,7 @@ public class WebParameterUtils {
      * @return a long value of parameter
      * @throws Exception if failed to parse the object
      */
-    public static long validLongDataParameter(String paramName, Object paramValue,
+    public static long validLongDataParameter(String paramName, String paramValue,
                                               boolean required, long defaultValue) throws Exception {
         String tmpParamValue = checkParamCommonRequires(paramName, paramValue, required);
         if (TStringUtils.isBlank(tmpParamValue)) {
@@ -79,7 +79,7 @@ public class WebParameterUtils {
      * @return a int value of parameter
      * @throws Exception if failed to parse the object
      */
-    public static int validIntDataParameter(String paramName, Object paramValue,
+    public static int validIntDataParameter(String paramName, String paramValue,
                                             boolean required, int defaultValue,
                                             int minValue) throws Exception {
         String tmpParamValue = checkParamCommonRequires(paramName, paramValue, required);
@@ -110,7 +110,7 @@ public class WebParameterUtils {
      * @return a boolean value of parameter
      * @throws Exception if failed to parse the object
      */
-    public static boolean validBooleanDataParameter(String paramName, Object paramValue,
+    public static boolean validBooleanDataParameter(String paramName, String paramValue,
                                                     boolean required, boolean defaultValue) throws Exception {
         String tmpParamValue = checkParamCommonRequires(paramName, paramValue, required);
         if (TStringUtils.isBlank(tmpParamValue)) {
@@ -129,7 +129,7 @@ public class WebParameterUtils {
      * @return a Date value of parameter
      * @throws Exception if failed to parse the object
      */
-    public static Date validDateParameter(String paramName, Object paramValue, int paramMaxLen,
+    public static Date validDateParameter(String paramName, String paramValue, int paramMaxLen,
                                           boolean required, Date defaultValue) throws Exception {
         String tmpParamValue = checkParamCommonRequires(paramName, paramValue, required);
         if (TStringUtils.isBlank(tmpParamValue)) {
@@ -161,7 +161,7 @@ public class WebParameterUtils {
      * @return a string value of parameter
      * @throws Exception if failed to parse the object
      */
-    public static String validStringParameter(String paramName, Object paramValue, int paramMaxLen,
+    public static String validStringParameter(String paramName, String paramValue, int paramMaxLen,
                                               boolean required, String defaultValue) throws Exception {
         String tmpParamValue = checkParamCommonRequires(paramName, paramValue, required);
         if (TStringUtils.isBlank(tmpParamValue)) {
@@ -193,7 +193,7 @@ public class WebParameterUtils {
      * @return a string value of parameter
      * @throws Exception if failed to parse the object
      */
-    public static String validGroupParameter(String paramName, Object paramValue, int paramMaxLen,
+    public static String validGroupParameter(String paramName, String paramValue, int paramMaxLen,
                                              boolean required, String defaultValue) throws Exception {
         String tmpParamValue = checkParamCommonRequires(paramName, paramValue, required);
         if (TStringUtils.isBlank(tmpParamValue)) {
@@ -225,7 +225,7 @@ public class WebParameterUtils {
      * @return a ip string of parameter
      * @throws Exception if failed to parse the object
      */
-    public static String validAddressParameter(String paramName, Object paramValue, int paramMaxLen,
+    public static String validAddressParameter(String paramName, String paramValue, int paramMaxLen,
                                                boolean required, String defaultValue) throws Exception {
         String tmpParamValue = checkParamCommonRequires(paramName, paramValue, required);
         if (TStringUtils.isBlank(tmpParamValue)) {
@@ -256,7 +256,7 @@ public class WebParameterUtils {
      * @return the decoded string of parameter
      * @throws Exception if failed to parse the object
      */
-    public static String validDecodeStringParameter(String paramName, Object paramValue, int paramMaxLen,
+    public static String validDecodeStringParameter(String paramName, String paramValue, int paramMaxLen,
                                                     boolean required, String defaultValue) throws Exception {
         String tmpParamValue = checkParamCommonRequires(paramName, paramValue, required);
         if (TStringUtils.isBlank(tmpParamValue)) {
@@ -315,7 +315,7 @@ public class WebParameterUtils {
      * @return the decoded string of parameter
      * @throws Exception if failed to parse the object
      */
-    public static String validDeletePolicyParameter(String paramName, Object paramValue,
+    public static String validDeletePolicyParameter(String paramName, String paramValue,
                                                     boolean required, String defaultValue) throws Exception {
         int paramMaxLen = TServerConstants.CFG_DELETEPOLICY_MAX_LENGTH;
         String tmpParamValue = checkParamCommonRequires(paramName, paramValue, required);
@@ -429,9 +429,9 @@ public class WebParameterUtils {
                 }
                 if (!filterCond.matches(TBaseConstants.META_TMP_FILTER_VALUE)) {
                     sb.delete(0, sb.length());
-                    throw new Exception(sb.append("Illegal value: the value of ").append(filterCond)
-                            .append(" in filterCond parameter must only contain characters,numbers,and underscores")
-                            .toString());
+                    throw new Exception(sb.append("Illegal value: the value of ")
+                        .append(filterCond).append(" in filterCond parameter ")
+                        .append("must only contain characters,numbers,and underscores").toString());
                 }
                 filterConds.add(filterCond);
             }
@@ -484,9 +484,9 @@ public class WebParameterUtils {
                 }
                 if (!filterCond.matches(TBaseConstants.META_TMP_FILTER_VALUE)) {
                     sb.delete(0, sb.length());
-                    throw new Exception(sb.append("Illegal value: the value of ").append(filterCond)
-                            .append(" in filterCond parameter must only contain characters,numbers,and underscores")
-                            .toString());
+                    throw new Exception(sb.append("Illegal value: the value of ")
+                        .append(filterCond).append(" in filterCond parameter must ")
+                        .append("only contain characters,numbers,and underscores").toString());
                 }
                 if (transCondItem) {
                     filterCondSet.add(sb.append(TokenConstants.ARRAY_SEP)
@@ -498,9 +498,9 @@ public class WebParameterUtils {
             }
             if (checkTotalCnt) {
                 if (filterCondSet.size() > TBaseConstants.CFG_FLT_MAX_FILTER_ITEM_COUNT) {
-                    throw new Exception(sb
-                            .append("Illegal value: the count of filterCond's value over max allowed count(")
-                            .append(TBaseConstants.CFG_FLT_MAX_FILTER_ITEM_COUNT).append(")!").toString());
+                    throw new Exception(sb.append("Illegal value: the count of filterCond's ")
+                        .append("value over max allowed count(")
+                        .append(TBaseConstants.CFG_FLT_MAX_FILTER_ITEM_COUNT).append(")!").toString());
                 }
             }
         }
@@ -525,7 +525,7 @@ public class WebParameterUtils {
         String[] strGroupNames = inputGroupName.split(TokenConstants.ARRAY_SEP);
         if (strGroupNames.length > TServerConstants.CFG_BATCH_RECORD_OPERATE_MAX_COUNT) {
             throw new Exception(sb.append("Illegal value: groupName's bath count over max count ")
-                    .append(TServerConstants.CFG_BATCH_RECORD_OPERATE_MAX_COUNT).toString());
+                .append(TServerConstants.CFG_BATCH_RECORD_OPERATE_MAX_COUNT).toString());
         }
         for (int i = 0; i < strGroupNames.length; i++) {
             if (TStringUtils.isBlank(strGroupNames[i])) {
@@ -536,7 +536,7 @@ public class WebParameterUtils {
                 if (resTokens != null && !resTokens.isEmpty()) {
                     if (resTokens.contains(groupName)) {
                         throw new Exception(sb.append("Illegal value: in groupName parameter, '")
-                                .append(groupName).append("' is a system reserved token!").toString());
+                            .append(groupName).append("' is a system reserved token!").toString());
                     }
                 }
             }
@@ -547,8 +547,7 @@ public class WebParameterUtils {
                         .append(" characters").toString());
             }
             if (!groupName.matches(TBaseConstants.META_TMP_GROUP_VALUE)) {
-                throw new Exception(sb.append("Illegal value: the value of ")
-                    .append(groupName)
+                throw new Exception(sb.append("Illegal value: the value of ").append(groupName)
                     .append("in groupName parameter must begin with a letter, can only contain ")
                     .append("characters,numbers,hyphen,and underscores").toString());
             }
@@ -595,10 +594,8 @@ public class WebParameterUtils {
             }
             if (!topicName.matches(TBaseConstants.META_TMP_STRING_VALUE)) {
                 throw new Exception(sb.append("Illegal value: the value of ")
-                        .append(topicName)
-                        .append("in topicName parameter must begin with a letter, can only contain characters," +
-                                "numbers,and underscores")
-                        .toString());
+                    .append(topicName).append(" in topicName parameter must begin with a letter,")
+                    .append(" can only contain characters,numbers,and underscores").toString());
             }
             if (checkRange) {
                 if (!checkedTopicList.contains(topicName)) {
@@ -736,10 +733,10 @@ public class WebParameterUtils {
      * @return a list of linked hash map represent the json array
      * @throws Exception
      */
-    public static List<Map<String, Object>> checkAndGetJsonArray(String paramName,
-                                                                           Object paramValue,
-                                                                           int paramMaxLen,
-                                                                           boolean required) throws Exception {
+    public static List<Map<String, String>> checkAndGetJsonArray(String paramName,
+                                                                 String paramValue,
+                                                                 int paramMaxLen,
+                                                                 boolean required) throws Exception {
         String tmpParamValue = checkParamCommonRequires(paramName, paramValue, required);
         if (TStringUtils.isBlank(tmpParamValue) && !required) {
             return null;
@@ -770,7 +767,7 @@ public class WebParameterUtils {
                         .append(" characters").toString());
             }
         }
-        return JSON.parseObject(decTmpParamVal, new TypeReference<List<Map<String, Object>>>() {});
+        return new Gson().fromJson(decTmpParamVal, new TypeToken<List<Map<String, String>>>(){}.getType());
     }
 
     /**
@@ -882,7 +879,7 @@ public class WebParameterUtils {
         return sdf.format(date);
     }
 
-    private static String checkParamCommonRequires(final String paramName, final Object paramValue,
+    private static String checkParamCommonRequires(final String paramName, final String paramValue,
                                                    boolean required) throws Exception {
         String temParamValue = null;
         if (paramValue == null) {
@@ -891,7 +888,7 @@ public class WebParameterUtils {
                         .append(paramName).append(" parameter").toString());
             }
         } else {
-            temParamValue = escDoubleQuotes(String.valueOf(paramValue).trim());
+            temParamValue = escDoubleQuotes(paramValue.trim());
             if (TStringUtils.isBlank(temParamValue)) {
                 if (required) {
                     throw new Exception(new StringBuilder(512)
diff --git a/tubemq-server/src/main/java/org/apache/tubemq/server/master/web/handler/WebAdminGroupCtrlHandler.java b/tubemq-server/src/main/java/org/apache/tubemq/server/master/web/handler/WebAdminGroupCtrlHandler.java
index eb1b7c4..7bd13d2 100644
--- a/tubemq-server/src/main/java/org/apache/tubemq/server/master/web/handler/WebAdminGroupCtrlHandler.java
+++ b/tubemq-server/src/main/java/org/apache/tubemq/server/master/web/handler/WebAdminGroupCtrlHandler.java
@@ -161,7 +161,7 @@ public class WebAdminGroupCtrlHandler {
                             req.getParameter("createDate"),
                             TBaseConstants.META_MAX_DATEVALUE_LENGTH,
                             false, new Date());
-            List<Map<String, Object>> filterJsonArray =
+            List<Map<String, String>> filterJsonArray =
                     WebParameterUtils.checkAndGetJsonArray("filterCondJsonSet",
                             req.getParameter("filterCondJsonSet"),
                             TBaseConstants.META_VALUE_UNDEFINED, true);
@@ -172,7 +172,7 @@ public class WebAdminGroupCtrlHandler {
             HashMap<String, BdbGroupFilterCondEntity> inGroupFilterCondEntityMap =
                     new HashMap<String, BdbGroupFilterCondEntity>();
             for (int j = 0; j < filterJsonArray.size(); j++) {
-                Map<String, Object> groupObject = filterJsonArray.get(j);
+                Map<String, String> groupObject = filterJsonArray.get(j);
                 try {
                     String groupName =
                         WebParameterUtils.validGroupParameter("groupName",
@@ -361,7 +361,7 @@ public class WebAdminGroupCtrlHandler {
                             req.getParameter("modifyDate"),
                             TBaseConstants.META_MAX_DATEVALUE_LENGTH,
                             false, new Date());
-            List<Map<String, Object>> jsonArray =
+            List<Map<String, String>> jsonArray =
                     WebParameterUtils.checkAndGetJsonArray("filterCondJsonSet",
                             req.getParameter("filterCondJsonSet"),
                             TBaseConstants.META_VALUE_UNDEFINED, true);
@@ -371,7 +371,7 @@ public class WebAdminGroupCtrlHandler {
             Set<String> bathRecords = new HashSet<String>();
             List<BdbGroupFilterCondEntity> modifyFilterCondEntitys = new ArrayList<>();
             for (int j = 0; j < jsonArray.size(); j++) {
-                Map<String, Object> groupObject = jsonArray.get(j);
+                Map<String, String> groupObject = jsonArray.get(j);
                 try {
                     String groupName =
                         WebParameterUtils.validGroupParameter("groupName",
@@ -771,7 +771,7 @@ public class WebAdminGroupCtrlHandler {
                             req.getParameter("createDate"),
                             TBaseConstants.META_MAX_DATEVALUE_LENGTH,
                             false, new Date());
-            List<Map<String, Object>> jsonArray =
+            List<Map<String, String>> jsonArray =
                     WebParameterUtils.checkAndGetJsonArray("groupNameJsonSet",
                             req.getParameter("groupNameJsonSet"),
                             TBaseConstants.META_VALUE_UNDEFINED, true);
@@ -782,7 +782,7 @@ public class WebAdminGroupCtrlHandler {
             HashMap<String, BdbConsumerGroupEntity> inGroupAuthConfEntityMap =
                     new HashMap<String, BdbConsumerGroupEntity>();
             for (int j = 0; j < jsonArray.size(); j++) {
-                Map<String, Object> groupObject = jsonArray.get(j);
+                Map<String, String> groupObject = jsonArray.get(j);
                 try {
                     String groupName =
                         WebParameterUtils.validGroupParameter("groupName",
@@ -1039,7 +1039,7 @@ public class WebAdminGroupCtrlHandler {
                             req.getParameter("createDate"),
                             TBaseConstants.META_MAX_DATEVALUE_LENGTH,
                             false, new Date());
-            List<Map<String, Object>> jsonArray =
+            List<Map<String, String>> jsonArray =
                     WebParameterUtils.checkAndGetJsonArray("groupNameJsonSet",
                             req.getParameter("groupNameJsonSet"),
                             TBaseConstants.META_VALUE_UNDEFINED, true);
@@ -1049,7 +1049,7 @@ public class WebAdminGroupCtrlHandler {
             Set<String> confgiuredTopicSet = brokerConfManage.getTotalConfiguredTopicNames();
             HashMap<String, BdbBlackGroupEntity> inBlackGroupEntityMap = new HashMap<>();
             for (int j = 0; j < jsonArray.size(); j++) {
-                Map<String, Object> groupObject = jsonArray.get(j);
+                Map<String, String> groupObject = jsonArray.get(j);
                 try {
                     String groupName =
                         WebParameterUtils.validGroupParameter("groupName",
@@ -1286,7 +1286,7 @@ public class WebAdminGroupCtrlHandler {
                     WebParameterUtils.validIntDataParameter("allowedBClientRate",
                             req.getParameter("allowedBClientRate"),
                             false, 0, 0);
-            List<Map<String, Object>> groupNameJsonArray =
+            List<Map<String, String>> groupNameJsonArray =
                     WebParameterUtils.checkAndGetJsonArray("groupNameJsonSet",
                             req.getParameter("groupNameJsonSet"),
                             TBaseConstants.META_VALUE_UNDEFINED, true);
@@ -1296,7 +1296,7 @@ public class WebAdminGroupCtrlHandler {
             HashMap<String, BdbConsumeGroupSettingEntity> inOffsetRstGroupEntityMap =
                     new HashMap<String, BdbConsumeGroupSettingEntity>();
             for (int j = 0; j < groupNameJsonArray.size(); j++) {
-                Map<String, Object> groupObject = groupNameJsonArray.get(j);
+                Map<String, String> groupObject = groupNameJsonArray.get(j);
                 try {
                     String groupName =
                         WebParameterUtils.validGroupParameter("groupName",
diff --git a/tubemq-server/src/main/java/org/apache/tubemq/server/master/web/handler/WebAdminTopicAuthHandler.java b/tubemq-server/src/main/java/org/apache/tubemq/server/master/web/handler/WebAdminTopicAuthHandler.java
index adc17c4..b9fad07 100644
--- a/tubemq-server/src/main/java/org/apache/tubemq/server/master/web/handler/WebAdminTopicAuthHandler.java
+++ b/tubemq-server/src/main/java/org/apache/tubemq/server/master/web/handler/WebAdminTopicAuthHandler.java
@@ -17,8 +17,9 @@
 
 package org.apache.tubemq.server.master.web.handler;
 
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.TypeReference;
+import com.google.gson.Gson;
+import com.google.gson.JsonParser;
+import com.google.gson.reflect.TypeToken;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.HashMap;
@@ -42,6 +43,7 @@ public class WebAdminTopicAuthHandler {
 
     private static final Logger logger =
             LoggerFactory.getLogger(WebAdminTopicAuthHandler.class);
+    private final JsonParser jsonParser = new JsonParser();
     private TMaster master;
     private BrokerConfManage brokerConfManage;
 
@@ -114,7 +116,7 @@ public class WebAdminTopicAuthHandler {
             Date createDate =
                     WebParameterUtils.validDateParameter("createDate", req.getParameter("createDate"),
                             TBaseConstants.META_MAX_DATEVALUE_LENGTH, false, new Date());
-            List<Map<String, Object>> topicJsonArray =
+            List<Map<String, String>> topicJsonArray =
                     WebParameterUtils.checkAndGetJsonArray("topicJsonSet",
                             req.getParameter("topicJsonSet"), TBaseConstants.META_VALUE_UNDEFINED, true);
             if ((topicJsonArray == null) || (topicJsonArray.isEmpty())) {
@@ -126,7 +128,7 @@ public class WebAdminTopicAuthHandler {
             HashMap<String, BdbConsumerGroupEntity> inGroupAuthConfEntityMap =
                     new HashMap<String, BdbConsumerGroupEntity>();
             for (int count = 0; count < topicJsonArray.size(); count++) {
-                Map<String, Object> jsonObject = topicJsonArray.get(count);
+                Map<String, String> jsonObject = topicJsonArray.get(count);
                 try {
                     String topicName =
                             WebParameterUtils.validStringParameter("topicName", jsonObject.get("topicName"),
@@ -350,13 +352,13 @@ public class WebAdminTopicAuthHandler {
             final String topicName,
             final String operator,
             final Date createDate,
-            final Map<String, Object> jsonObject,
+            final Map<String, String> jsonObject,
             HashMap<String, BdbConsumerGroupEntity> groupAuthEntityMap,
             final StringBuilder sBuilder) throws Exception {
         String strAuthConsumGroup = (String) jsonObject.get("authConsumeGroup");
         if ((strAuthConsumGroup != null) && (!TStringUtils.isBlank(strAuthConsumGroup))) {
             List<Map<String, String>> authConsumeGroupSet =
-                    JSON.parseObject(strAuthConsumGroup, new TypeReference<List<Map<String, String>>>() {});
+                new Gson().fromJson(strAuthConsumGroup, new TypeToken<List<Map<String, String>>>(){}.getType());
             if ((authConsumeGroupSet != null)
                     && (!authConsumeGroupSet.isEmpty())) {
                 for (int j = 0; j < authConsumeGroupSet.size(); j++) {
diff --git a/tubemq-server/src/main/java/org/apache/tubemq/server/master/web/handler/WebBrokerDefConfHandler.java b/tubemq-server/src/main/java/org/apache/tubemq/server/master/web/handler/WebBrokerDefConfHandler.java
index 70f72a7..6d1d632 100644
--- a/tubemq-server/src/main/java/org/apache/tubemq/server/master/web/handler/WebBrokerDefConfHandler.java
+++ b/tubemq-server/src/main/java/org/apache/tubemq/server/master/web/handler/WebBrokerDefConfHandler.java
@@ -322,7 +322,7 @@ public class WebBrokerDefConfHandler {
             Date createDate =
                     WebParameterUtils.validDateParameter("createDate", req.getParameter("createDate"),
                             TBaseConstants.META_MAX_DATEVALUE_LENGTH, false, new Date());
-            List<Map<String, Object>> brokerJsonArray =
+            List<Map<String, String>> brokerJsonArray =
                     WebParameterUtils.checkAndGetJsonArray("brokerJsonSet",
                             req.getParameter("brokerJsonSet"), TBaseConstants.META_VALUE_UNDEFINED, true);
             if ((brokerJsonArray == null) || (brokerJsonArray.isEmpty())) {
@@ -332,7 +332,7 @@ public class WebBrokerDefConfHandler {
             ConcurrentHashMap<Integer, BdbBrokerConfEntity> bdbBrokerConfEntityMap =
                     brokerConfManage.getBrokerConfStoreMap();
             for (int count = 0; count < brokerJsonArray.size(); count++) {
-                Map<String, Object> jsonObject = brokerJsonArray.get(count);
+                Map<String, String> jsonObject = brokerJsonArray.get(count);
                 try {
                     String brokerIp =
                             WebParameterUtils.validAddressParameter("brokerIp", jsonObject.get("brokerIp"),
diff --git a/tubemq-server/src/main/java/org/apache/tubemq/server/master/web/handler/WebBrokerTopicConfHandler.java b/tubemq-server/src/main/java/org/apache/tubemq/server/master/web/handler/WebBrokerTopicConfHandler.java
index a73b5aa..d681bca 100644
--- a/tubemq-server/src/main/java/org/apache/tubemq/server/master/web/handler/WebBrokerTopicConfHandler.java
+++ b/tubemq-server/src/main/java/org/apache/tubemq/server/master/web/handler/WebBrokerTopicConfHandler.java
@@ -233,7 +233,7 @@ public class WebBrokerTopicConfHandler {
             Date createDate =
                     WebParameterUtils.validDateParameter("createDate", req.getParameter("createDate"),
                             TBaseConstants.META_MAX_DATEVALUE_LENGTH, false, new Date());
-            List<Map<String, Object>> topicJsonArray =
+            List<Map<String, String>> topicJsonArray =
                     WebParameterUtils.checkAndGetJsonArray("topicJsonSet",
                             req.getParameter("topicJsonSet"), TBaseConstants.META_VALUE_UNDEFINED, true);
             if ((topicJsonArray == null) || (topicJsonArray.isEmpty())) {
@@ -244,7 +244,7 @@ public class WebBrokerTopicConfHandler {
             List<BdbTopicAuthControlEntity> bathTopicAuthInfos = new ArrayList<BdbTopicAuthControlEntity>();
             List<BdbTopicConfEntity> bathAddBdbTopicEntitys = new ArrayList<BdbTopicConfEntity>();
             for (int count = 0; count < topicJsonArray.size(); count++) {
-                Map<String, Object> jsonObject = topicJsonArray.get(count);
+                Map<String, String> jsonObject = topicJsonArray.get(count);
                 try {
                     int brokerId =
                             WebParameterUtils.validIntDataParameter("brokerId",