From 8db4ff7dd07f1cda74740185b5910de017e0acf4 Mon Sep 17 00:00:00 2001 From: niloay6 Date: Tue, 27 Jul 2021 10:50:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dtracker=5Fserver?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=B8=BA=E5=9F=9F=E5=90=8D=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E4=BF=A1=E6=81=AF=E6=9C=89=E8=AF=AF=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/org/csource/fastdfs/ClientGlobal.java | 3 ++- src/test/java/org/csource/fastdfs/ClientGlobalTests.java | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/csource/fastdfs/ClientGlobal.java b/src/main/java/org/csource/fastdfs/ClientGlobal.java index ff465be..382e2a5 100644 --- a/src/main/java/org/csource/fastdfs/ClientGlobal.java +++ b/src/main/java/org/csource/fastdfs/ClientGlobal.java @@ -337,7 +337,8 @@ public class ClientGlobal { InetSocketAddress[] trackerAddresses = g_tracker_group.tracker_servers; for (InetSocketAddress inetSocketAddress : trackerAddresses) { if(trackerServers.length() > 0) trackerServers += ","; - trackerServers += inetSocketAddress.toString().substring(1); + String address = inetSocketAddress.toString(); + trackerServers += address.startsWith("/") ? address.substring(1) : address; } } return "{" diff --git a/src/test/java/org/csource/fastdfs/ClientGlobalTests.java b/src/test/java/org/csource/fastdfs/ClientGlobalTests.java index d8f0320..f905fc8 100644 --- a/src/test/java/org/csource/fastdfs/ClientGlobalTests.java +++ b/src/test/java/org/csource/fastdfs/ClientGlobalTests.java @@ -21,6 +21,9 @@ public class ClientGlobalTests { ClientGlobal.initByProperties(props); System.out.println("ClientGlobal.configInfo(): " + ClientGlobal.configInfo()); + String trackerServer = "www.baidu.com:22122"; + ClientGlobal.initByTrackers(trackerServer); + System.out.println("Host >>> ClientGlobal.configInfo() : " + ClientGlobal.configInfo()); } }