From 03987330a417df6f1841f0b91dbebee9b14ce9f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E7=BF=8A=20SionYang?= Date: Fri, 17 Nov 2023 17:56:50 +0800 Subject: [PATCH] Upgrade dependency to reduce conflicts and add leak UT coverage files. (#11396) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove custom jackson version and jackson-core-asl. * Upgrade protobuf relative version to reduce conflict with grpc. * 补充提交遗漏单测覆盖率的模块。 --- .github/workflows/ci.yml | 2 +- naming/pom.xml | 4 --- .../alibaba/nacos/naming/push/ClientInfo.java | 8 ++--- .../nacos/naming/push/UdpPushService.java | 17 +++++++---- pom.xml | 30 ++----------------- sys/pom.xml | 10 ++----- 6 files changed, 21 insertions(+), 50 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54a85e62cb5..917c7428f90 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,4 +46,4 @@ jobs: - name: "Codecov" uses: codecov/codecov-action@v3.1.0 with: - files: ./address/target/site/jacoco/jacoco.xml,./api/target/site/jacoco/jacoco.xml,./auth/target/site/jacoco/jacoco.xml,./client/target/site/jacoco/jacoco.xml,./common/target/site/jacoco/jacoco.xml,./consistency/target/site/jacoco/jacoco.xml,./console/target/site/jacoco/jacoco.xml,./core/target/site/jacoco/jacoco.xml,./naming/target/site/jacoco/jacoco.xml,./plugin-default-impl/target/site/jacoco/jacoco.xml,./plugin/auth/target/site/jacoco/jacoco.xml,./plugin/encryption/target/site/jacoco/jacoco.xml,./sys/target/site/jacoco/jacoco.xml + files: ./address/target/site/jacoco/jacoco.xml,./api/target/site/jacoco/jacoco.xml,./auth/target/site/jacoco/jacoco.xml,./client/target/site/jacoco/jacoco.xml,./common/target/site/jacoco/jacoco.xml,./consistency/target/site/jacoco/jacoco.xml,./console/target/site/jacoco/jacoco.xml,./core/target/site/jacoco/jacoco.xml,./naming/target/site/jacoco/jacoco.xml,./persistence/target/site/jacoco/jacoco.xml,./plugin-default-impl/nacos-default-auth-plugin/target/site/jacoco/jacoco.xml,./plugin/auth/target/site/jacoco/jacoco.xml,./plugin/config/target/site/jacoco/jacoco.xml,./plugin/control/target/site/jacoco/jacoco.xml,./plugin/datasource/target/site/jacoco/jacoco.xml,./plugin/encryption/target/site/jacoco/jacoco.xml,./plugin/environment/target/site/jacoco/jacoco.xml,./plugin/trace/target/site/jacoco/jacoco.xml,./prometheus/target/site/jacoco/jacoco.xml,./sys/target/site/jacoco/jacoco.xml diff --git a/naming/pom.xml b/naming/pom.xml index ba5f6fe3cc4..e3c1b3a4116 100644 --- a/naming/pom.xml +++ b/naming/pom.xml @@ -62,10 +62,6 @@ commons-collections commons-collections - - org.codehaus.jackson - jackson-core-asl - org.slf4j diff --git a/naming/src/main/java/com/alibaba/nacos/naming/push/ClientInfo.java b/naming/src/main/java/com/alibaba/nacos/naming/push/ClientInfo.java index c76396b0925..29c06a87f17 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/push/ClientInfo.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/push/ClientInfo.java @@ -16,10 +16,10 @@ package com.alibaba.nacos.naming.push; -import com.alibaba.nacos.naming.misc.UtilsAndCommons; import com.alibaba.nacos.common.utils.StringUtils; -import org.codehaus.jackson.Version; -import org.codehaus.jackson.util.VersionUtil; +import com.alibaba.nacos.naming.misc.UtilsAndCommons; +import com.fasterxml.jackson.core.Version; +import com.fasterxml.jackson.core.util.VersionUtil; /** * Client info. @@ -49,7 +49,7 @@ private Version parseVersion(String versionStr) { if (versionStartIndex < 0) { return Version.unknownVersion(); } - return VersionUtil.parseVersion(versionStr.substring(versionStartIndex + 2)); + return VersionUtil.parseVersion(versionStr.substring(versionStartIndex + 2), null, null); } public enum ClientType { diff --git a/naming/src/main/java/com/alibaba/nacos/naming/push/UdpPushService.java b/naming/src/main/java/com/alibaba/nacos/naming/push/UdpPushService.java index 7042c39a8ef..d7378b5be8b 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/push/UdpPushService.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/push/UdpPushService.java @@ -24,8 +24,9 @@ import com.alibaba.nacos.naming.pojo.Subscriber; import com.alibaba.nacos.naming.remote.udp.AckEntry; import com.alibaba.nacos.naming.remote.udp.UdpConnector; +import com.fasterxml.jackson.core.Version; +import com.fasterxml.jackson.core.util.VersionUtil; import org.apache.commons.collections.MapUtils; -import org.codehaus.jackson.util.VersionUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -153,25 +154,29 @@ public boolean canEnablePush(String agent) { ClientInfo clientInfo = new ClientInfo(agent); if (ClientInfo.ClientType.JAVA == clientInfo.type - && clientInfo.version.compareTo(VersionUtil.parseVersion(switchDomain.getPushJavaVersion())) >= 0) { + && clientInfo.version.compareTo(parseVersion(switchDomain.getPushJavaVersion())) >= 0) { return true; } else if (ClientInfo.ClientType.DNS == clientInfo.type - && clientInfo.version.compareTo(VersionUtil.parseVersion(switchDomain.getPushPythonVersion())) >= 0) { + && clientInfo.version.compareTo(parseVersion(switchDomain.getPushPythonVersion())) >= 0) { return true; } else if (ClientInfo.ClientType.C == clientInfo.type - && clientInfo.version.compareTo(VersionUtil.parseVersion(switchDomain.getPushCVersion())) >= 0) { + && clientInfo.version.compareTo(parseVersion(switchDomain.getPushCVersion())) >= 0) { return true; } else if (ClientInfo.ClientType.GO == clientInfo.type - && clientInfo.version.compareTo(VersionUtil.parseVersion(switchDomain.getPushGoVersion())) >= 0) { + && clientInfo.version.compareTo(parseVersion(switchDomain.getPushGoVersion())) >= 0) { return true; } else if (ClientInfo.ClientType.CSHARP == clientInfo.type - && clientInfo.version.compareTo(VersionUtil.parseVersion(switchDomain.getPushCSharpVersion())) >= 0) { + && clientInfo.version.compareTo(parseVersion(switchDomain.getPushCSharpVersion())) >= 0) { return true; } return false; } + private Version parseVersion(String version) { + return VersionUtil.parseVersion(version, null, null); + } + private static byte[] compressIfNecessary(byte[] dataBytes) throws IOException { // enable compression when data is larger than 1KB int maxDataSizeUncompress = 1024; diff --git a/pom.xml b/pom.xml index 592486ce133..e5c10d83c10 100644 --- a/pom.xml +++ b/pom.xml @@ -137,15 +137,11 @@ 8.0.28 10.14.2.0 - 2.12.6 - 2.12.7.1 - 2.12.6 - 1.9.13 0.11.2 1.2 1.57.2 - 2.7.1 - 3.21.11 + 2.17.0 + 3.22.3 ${grpc-java.version} 4.0.63 1.10.19 @@ -901,28 +897,6 @@ - - com.fasterxml.jackson.core - jackson-core - ${jackson-core.version} - - - - com.fasterxml.jackson.core - jackson-databind - ${jackson-databind.version} - - - com.fasterxml.jackson.core - jackson-annotations - ${jackson.annotations.version} - - - org.codehaus.jackson - jackson-core-asl - ${jackson-core-asl.version} - - io.jsonwebtoken jjwt-api diff --git a/sys/pom.xml b/sys/pom.xml index ed5967f57b1..62f573160c1 100644 --- a/sys/pom.xml +++ b/sys/pom.xml @@ -41,7 +41,7 @@ org.springframework.boot spring-boot-starter - + org.springframework.boot spring-boot-starter-test @@ -53,20 +53,16 @@ - + org.springframework spring-test - + org.springframework.boot spring-boot-test - - org.codehaus.jackson - jackson-core-asl - com.alibaba.nacos nacos-custom-environment-plugin