From 6a0d71a26dd7348b292641c66aceb5aebe049a19 Mon Sep 17 00:00:00 2001 From: chuntaojun Date: Tue, 21 Apr 2020 17:26:15 +0800 Subject: [PATCH] style: fix code style to adapter PMD --- .../java/com/alibaba/nacos/core/cluster/MemberUtils.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/alibaba/nacos/core/cluster/MemberUtils.java b/core/src/main/java/com/alibaba/nacos/core/cluster/MemberUtils.java index 6c0e0a3b6..f0333410c 100644 --- a/core/src/main/java/com/alibaba/nacos/core/cluster/MemberUtils.java +++ b/core/src/main/java/com/alibaba/nacos/core/cluster/MemberUtils.java @@ -34,6 +34,8 @@ import java.util.function.Predicate; */ public class MemberUtils { + private static final String SEMICOLON = ":"; + private static ServerMemberManager manager; public static void setManager(ServerMemberManager manager) { @@ -48,6 +50,7 @@ public class MemberUtils { oldMember.setAddress(newMember.getAddress()); } + @SuppressWarnings("PMD.UndefineMagicConstantRule") public static Member singleParse(String member) { int selfPort = ApplicationUtils.getPort(); // Nacos default port is 8848 @@ -58,8 +61,8 @@ public class MemberUtils { String[] memberDetails = member.split("\\?"); String address = memberDetails[0]; int port = defaultPort; - if (address.contains(":")) { - String[] info = address.split(":"); + if (address.contains(SEMICOLON)) { + String[] info = address.split(SEMICOLON); address = info[0]; port = Integer.parseInt(info[1]); }