From 0b6246e9f57519d1f96f3642c4cfa96c813154d8 Mon Sep 17 00:00:00 2001 From: "water.lyl" Date: Mon, 1 Apr 2019 21:16:44 +0800 Subject: [PATCH] remove lgpl dependency --- client/pom.xml | 10 ++++++++-- .../client/config/http/ServerHttpAgent.java | 5 ++--- .../alibaba/nacos/client/utils/JSONUtils.java | 18 ++++-------------- config/pom.xml | 9 +++++++-- .../server/service/ConfigSubService.java | 3 +-- .../nacos/config/server/utils/JSONUtils.java | 19 +++++-------------- pom.xml | 11 ++++++++--- 7 files changed, 35 insertions(+), 40 deletions(-) diff --git a/client/pom.xml b/client/pom.xml index d68db24e9..329fe2543 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -85,9 +85,15 @@ - org.codehaus.jackson - jackson-mapper-lgpl + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.core + jackson-databind + + net.jcip jcip-annotations diff --git a/client/src/main/java/com/alibaba/nacos/client/config/http/ServerHttpAgent.java b/client/src/main/java/com/alibaba/nacos/client/config/http/ServerHttpAgent.java index 2ec9065e3..f26135c12 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/http/ServerHttpAgent.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/http/ServerHttpAgent.java @@ -29,10 +29,9 @@ import com.alibaba.nacos.client.utils.JSONUtils; import com.alibaba.nacos.client.utils.LogUtils; import com.alibaba.nacos.client.utils.ParamUtil; import com.alibaba.nacos.client.utils.StringUtils; -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.type.TypeReference; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; import org.slf4j.Logger; - import java.io.IOException; import java.net.ConnectException; import java.net.HttpURLConnection; diff --git a/client/src/main/java/com/alibaba/nacos/client/utils/JSONUtils.java b/client/src/main/java/com/alibaba/nacos/client/utils/JSONUtils.java index 2a75beaf9..017a05df1 100644 --- a/client/src/main/java/com/alibaba/nacos/client/utils/JSONUtils.java +++ b/client/src/main/java/com/alibaba/nacos/client/utils/JSONUtils.java @@ -16,11 +16,9 @@ package com.alibaba.nacos.client.utils; import java.io.IOException; - -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.DeserializationConfig.Feature; -import org.codehaus.jackson.type.JavaType; -import org.codehaus.jackson.type.TypeReference; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; /** * Json tool @@ -33,7 +31,7 @@ public class JSONUtils { static ObjectMapper mapper = new ObjectMapper(); static { - mapper.disable(Feature.FAIL_ON_UNKNOWN_PROPERTIES); + mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); } public static String serializeObject(Object o) throws IOException { @@ -49,12 +47,4 @@ public class JSONUtils { return mapper.readValue(s, typeReference); } - public static JavaType getCollectionType(Class collectionClass, Class... elementClasses) { - return mapper.getTypeFactory().constructParametricType(collectionClass, elementClasses); - } - - public static Object deserializeCollection(String s, JavaType type) throws IOException { - return mapper.readValue(s, type); - } - } diff --git a/config/pom.xml b/config/pom.xml index e3a34d7b5..0d410c0fd 100644 --- a/config/pom.xml +++ b/config/pom.xml @@ -103,9 +103,14 @@ org.springframework.boot spring-boot-starter-tomcat + - org.codehaus.jackson - jackson-mapper-lgpl + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.core + jackson-databind net.jcip diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/ConfigSubService.java b/config/src/main/java/com/alibaba/nacos/config/server/service/ConfigSubService.java index 86f3e32b3..3a69043e2 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/ConfigSubService.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/ConfigSubService.java @@ -23,10 +23,9 @@ import com.alibaba.nacos.config.server.utils.LogUtil; import com.alibaba.nacos.config.server.utils.RunningConfigUtils; import com.alibaba.nacos.config.server.utils.ThreadUtil; import org.apache.commons.lang3.StringUtils; -import org.codehaus.jackson.type.TypeReference; +import com.fasterxml.jackson.core.type.TypeReference; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; - import java.net.HttpURLConnection; import java.net.URLEncoder; import java.util.ArrayList; diff --git a/config/src/main/java/com/alibaba/nacos/config/server/utils/JSONUtils.java b/config/src/main/java/com/alibaba/nacos/config/server/utils/JSONUtils.java index 9ae850fb5..231fd4846 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/utils/JSONUtils.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/utils/JSONUtils.java @@ -15,12 +15,11 @@ */ package com.alibaba.nacos.config.server.utils; -import org.codehaus.jackson.map.DeserializationConfig.Feature; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.type.JavaType; -import org.codehaus.jackson.type.TypeReference; - import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; + /** * json util @@ -33,7 +32,7 @@ public class JSONUtils { static ObjectMapper mapper = new ObjectMapper(); static { - mapper.disable(Feature.FAIL_ON_UNKNOWN_PROPERTIES); + mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); } public static String serializeObject(Object o) throws IOException { @@ -49,12 +48,4 @@ public class JSONUtils { return mapper.readValue(s, typeReference); } - public static JavaType getCollectionType(Class collectionClass, Class... elementClasses) { - return mapper.getTypeFactory().constructParametricType(collectionClass, elementClasses); - } - - public static Object deserializeCollection(String s, JavaType type) throws IOException { - return mapper.readValue(s, type); - } - } diff --git a/pom.xml b/pom.xml index 43601d940..2d01bc096 100644 --- a/pom.xml +++ b/pom.xml @@ -680,11 +680,16 @@ - org.codehaus.jackson - jackson-mapper-lgpl - 1.9.6 + com.fasterxml.jackson.core + jackson-core + 2.9.8 + + com.fasterxml.jackson.core + jackson-databind + 2.9.8 + org.codehaus.jackson jackson-core-asl