diff --git a/client/src/main/java/com/alibaba/nacos/client/config/NacosConfigService.java b/client/src/main/java/com/alibaba/nacos/client/config/NacosConfigService.java index a9ac0c9b9..8f889a660 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/NacosConfigService.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/NacosConfigService.java @@ -33,9 +33,9 @@ import com.alibaba.nacos.client.config.impl.LocalConfigInfoProcessor; import com.alibaba.nacos.client.config.utils.ContentUtils; import com.alibaba.nacos.client.config.utils.ParamUtils; import com.alibaba.nacos.client.utils.LogUtils; -import com.alibaba.nacos.client.utils.StringUtils; import com.alibaba.nacos.client.utils.TemplateUtils; import com.alibaba.nacos.client.utils.TenantUtil; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import java.io.IOException; diff --git a/client/src/main/java/com/alibaba/nacos/client/config/common/GroupKey.java b/client/src/main/java/com/alibaba/nacos/client/config/common/GroupKey.java index 2f7d527ef..aa0a26197 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/common/GroupKey.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/common/GroupKey.java @@ -15,7 +15,7 @@ */ package com.alibaba.nacos.client.config.common; -import com.alibaba.nacos.client.utils.StringUtils; +import org.apache.commons.lang3.StringUtils; /** * Synthesize the form of dataId+groupId. Escapes reserved characters in dataId and groupId. 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 0ba8f8a82..ce2d43e3f 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 @@ -28,9 +28,9 @@ import com.alibaba.nacos.client.utils.TemplateUtils; 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 com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.slf4j.Logger; import java.io.IOException; diff --git a/client/src/main/java/com/alibaba/nacos/client/config/impl/ClientWorker.java b/client/src/main/java/com/alibaba/nacos/client/config/impl/ClientWorker.java index 4e89dcbdf..6a86d0fd5 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/impl/ClientWorker.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/impl/ClientWorker.java @@ -28,7 +28,7 @@ import com.alibaba.nacos.client.config.utils.MD5; import com.alibaba.nacos.client.monitor.MetricsMonitor; import com.alibaba.nacos.client.utils.LogUtils; import com.alibaba.nacos.client.utils.ParamUtil; -import com.alibaba.nacos.client.utils.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import com.alibaba.nacos.client.utils.TenantUtil; import org.slf4j.Logger; diff --git a/client/src/main/java/com/alibaba/nacos/client/config/impl/LocalConfigInfoProcessor.java b/client/src/main/java/com/alibaba/nacos/client/config/impl/LocalConfigInfoProcessor.java index f41003cc6..715034073 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/impl/LocalConfigInfoProcessor.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/impl/LocalConfigInfoProcessor.java @@ -21,7 +21,7 @@ import com.alibaba.nacos.client.config.utils.IOUtils; import com.alibaba.nacos.client.config.utils.JVMUtil; import com.alibaba.nacos.client.config.utils.SnapShotSwitch; import com.alibaba.nacos.client.utils.LogUtils; -import com.alibaba.nacos.client.utils.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import java.io.File; diff --git a/client/src/main/java/com/alibaba/nacos/client/config/impl/SpasAdapter.java b/client/src/main/java/com/alibaba/nacos/client/config/impl/SpasAdapter.java index 7db3a4fdc..c881b23ce 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/impl/SpasAdapter.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/impl/SpasAdapter.java @@ -18,7 +18,7 @@ package com.alibaba.nacos.client.config.impl; import com.alibaba.nacos.api.common.Constants; import com.alibaba.nacos.client.identify.Base64; import com.alibaba.nacos.client.identify.CredentialService; -import com.alibaba.nacos.client.utils.StringUtils; +import org.apache.commons.lang3.StringUtils; import javax.crypto.Mac; import javax.crypto.SecretKey; diff --git a/client/src/main/java/com/alibaba/nacos/client/config/listener/impl/PropertiesListener.java b/client/src/main/java/com/alibaba/nacos/client/config/listener/impl/PropertiesListener.java index bab7f1125..37aed761f 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/listener/impl/PropertiesListener.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/listener/impl/PropertiesListener.java @@ -17,7 +17,7 @@ package com.alibaba.nacos.client.config.listener.impl; import com.alibaba.nacos.api.config.listener.AbstractListener; import com.alibaba.nacos.client.utils.LogUtils; -import com.alibaba.nacos.client.utils.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import java.io.IOException; diff --git a/client/src/main/java/com/alibaba/nacos/client/config/utils/ParamUtils.java b/client/src/main/java/com/alibaba/nacos/client/config/utils/ParamUtils.java index 477db7e27..c42baef4e 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/utils/ParamUtils.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/utils/ParamUtils.java @@ -19,7 +19,7 @@ import java.util.List; import com.alibaba.nacos.api.exception.NacosException; import com.alibaba.nacos.client.utils.IPUtil; -import com.alibaba.nacos.client.utils.StringUtils; +import org.apache.commons.lang3.StringUtils; /** * Param check util diff --git a/client/src/main/java/com/alibaba/nacos/client/identify/CredentialService.java b/client/src/main/java/com/alibaba/nacos/client/identify/CredentialService.java index 4ce6edb67..f238345fc 100644 --- a/client/src/main/java/com/alibaba/nacos/client/identify/CredentialService.java +++ b/client/src/main/java/com/alibaba/nacos/client/identify/CredentialService.java @@ -16,7 +16,7 @@ package com.alibaba.nacos.client.identify; import com.alibaba.nacos.client.utils.LogUtils; -import com.alibaba.nacos.client.utils.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import java.util.concurrent.ConcurrentHashMap; diff --git a/client/src/main/java/com/alibaba/nacos/client/identify/CredentialWatcher.java b/client/src/main/java/com/alibaba/nacos/client/identify/CredentialWatcher.java index 47c39b6e3..103891e79 100644 --- a/client/src/main/java/com/alibaba/nacos/client/identify/CredentialWatcher.java +++ b/client/src/main/java/com/alibaba/nacos/client/identify/CredentialWatcher.java @@ -16,7 +16,7 @@ package com.alibaba.nacos.client.identify; import com.alibaba.nacos.client.utils.LogUtils; -import com.alibaba.nacos.client.utils.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import java.io.*; diff --git a/client/src/main/java/com/alibaba/nacos/client/identify/STSConfig.java b/client/src/main/java/com/alibaba/nacos/client/identify/STSConfig.java index dfc76b141..80139020e 100644 --- a/client/src/main/java/com/alibaba/nacos/client/identify/STSConfig.java +++ b/client/src/main/java/com/alibaba/nacos/client/identify/STSConfig.java @@ -15,7 +15,7 @@ */ package com.alibaba.nacos.client.identify; -import com.alibaba.nacos.client.utils.StringUtils; +import org.apache.commons.lang3.StringUtils; /** * Sts config diff --git a/client/src/main/java/com/alibaba/nacos/client/logging/AbstractNacosLogging.java b/client/src/main/java/com/alibaba/nacos/client/logging/AbstractNacosLogging.java index 2fae7c74e..e7512f522 100644 --- a/client/src/main/java/com/alibaba/nacos/client/logging/AbstractNacosLogging.java +++ b/client/src/main/java/com/alibaba/nacos/client/logging/AbstractNacosLogging.java @@ -15,8 +15,8 @@ */ package com.alibaba.nacos.client.logging; -import com.alibaba.nacos.client.utils.StringUtils; import org.apache.commons.lang3.BooleanUtils; +import org.apache.commons.lang3.StringUtils; /** * @author hxy1991 diff --git a/client/src/main/java/com/alibaba/nacos/client/logging/logback/LogbackNacosLogging.java b/client/src/main/java/com/alibaba/nacos/client/logging/logback/LogbackNacosLogging.java index 68c053830..13739e528 100644 --- a/client/src/main/java/com/alibaba/nacos/client/logging/logback/LogbackNacosLogging.java +++ b/client/src/main/java/com/alibaba/nacos/client/logging/logback/LogbackNacosLogging.java @@ -18,8 +18,8 @@ package com.alibaba.nacos.client.logging.logback; import ch.qos.logback.classic.LoggerContext; import ch.qos.logback.classic.util.ContextInitializer; import com.alibaba.nacos.client.logging.AbstractNacosLogging; -import com.alibaba.nacos.client.utils.StringUtils; import com.alibaba.nacos.common.util.ResourceUtils; +import org.apache.commons.lang3.StringUtils; import org.slf4j.impl.StaticLoggerBinder; /** diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/NacosNamingMaintainService.java b/client/src/main/java/com/alibaba/nacos/client/naming/NacosNamingMaintainService.java index 15b4ae14f..c3652e75f 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/NacosNamingMaintainService.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/NacosNamingMaintainService.java @@ -27,7 +27,7 @@ import com.alibaba.nacos.api.selector.ExpressionSelector; import com.alibaba.nacos.api.selector.NoneSelector; import com.alibaba.nacos.client.naming.net.NamingProxy; import com.alibaba.nacos.client.naming.utils.InitUtils; -import com.alibaba.nacos.client.utils.StringUtils; +import org.apache.commons.lang3.StringUtils; import java.util.Map; import java.util.Properties; diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/NacosNamingService.java b/client/src/main/java/com/alibaba/nacos/client/naming/NacosNamingService.java index 4c61a73c5..3e5fb334c 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/NacosNamingService.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/NacosNamingService.java @@ -34,8 +34,8 @@ import com.alibaba.nacos.client.naming.net.NamingProxy; import com.alibaba.nacos.client.naming.utils.CollectionUtils; import com.alibaba.nacos.client.naming.utils.InitUtils; import com.alibaba.nacos.client.naming.utils.UtilAndComs; -import com.alibaba.nacos.client.utils.StringUtils; import org.apache.commons.lang3.BooleanUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import java.util.ArrayList; diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/backups/FailoverReactor.java b/client/src/main/java/com/alibaba/nacos/client/naming/backups/FailoverReactor.java index 52c2ee972..cdf4ff80f 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/backups/FailoverReactor.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/backups/FailoverReactor.java @@ -22,7 +22,7 @@ import com.alibaba.nacos.client.naming.cache.DiskCache; import com.alibaba.nacos.client.naming.core.HostReactor; import com.alibaba.nacos.client.naming.utils.CollectionUtils; import com.alibaba.nacos.client.naming.utils.UtilAndComs; -import com.alibaba.nacos.client.utils.StringUtils; +import org.apache.commons.lang3.StringUtils; import java.io.BufferedReader; import java.io.File; diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/cache/DiskCache.java b/client/src/main/java/com/alibaba/nacos/client/naming/cache/DiskCache.java index 6fe5a4a72..9394f8768 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/cache/DiskCache.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/cache/DiskCache.java @@ -20,7 +20,7 @@ import com.alibaba.nacos.api.common.Constants; import com.alibaba.nacos.api.naming.pojo.Instance; import com.alibaba.nacos.api.naming.pojo.ServiceInfo; import com.alibaba.nacos.client.naming.utils.CollectionUtils; -import com.alibaba.nacos.client.utils.StringUtils; +import org.apache.commons.lang3.StringUtils; import java.io.BufferedReader; import java.io.File; diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/core/HostReactor.java b/client/src/main/java/com/alibaba/nacos/client/naming/core/HostReactor.java index 65d711c22..bb96821c3 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/core/HostReactor.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/core/HostReactor.java @@ -24,7 +24,7 @@ import com.alibaba.nacos.client.naming.backups.FailoverReactor; import com.alibaba.nacos.client.naming.cache.DiskCache; import com.alibaba.nacos.client.naming.net.NamingProxy; import com.alibaba.nacos.client.naming.utils.UtilAndComs; -import com.alibaba.nacos.client.utils.StringUtils; +import org.apache.commons.lang3.StringUtils; import java.util.*; import java.util.concurrent.*; diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/net/HttpClient.java b/client/src/main/java/com/alibaba/nacos/client/naming/net/HttpClient.java index 3259d53c9..c58248754 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/net/HttpClient.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/net/HttpClient.java @@ -17,8 +17,8 @@ package com.alibaba.nacos.client.naming.net; import com.alibaba.nacos.api.common.Constants; import com.alibaba.nacos.client.naming.utils.IoUtils; -import com.alibaba.nacos.client.utils.StringUtils; import com.google.common.net.HttpHeaders; +import org.apache.commons.lang3.StringUtils; import java.io.IOException; import java.io.InputStream; diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/net/NamingProxy.java b/client/src/main/java/com/alibaba/nacos/client/naming/net/NamingProxy.java index 3eec5d752..d52c48486 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/net/NamingProxy.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/net/NamingProxy.java @@ -33,12 +33,12 @@ import com.alibaba.nacos.client.monitor.MetricsMonitor; import com.alibaba.nacos.client.naming.beat.BeatInfo; import com.alibaba.nacos.client.naming.utils.*; import com.alibaba.nacos.client.utils.AppNameUtils; -import com.alibaba.nacos.client.utils.StringUtils; import com.alibaba.nacos.client.utils.TemplateUtils; import com.alibaba.nacos.common.constant.HttpHeaderConsts; import com.alibaba.nacos.common.util.HttpMethod; import com.alibaba.nacos.common.util.UuidUtils; import com.alibaba.nacos.common.util.VersionUtils; +import org.apache.commons.lang3.StringUtils; import java.io.IOException; import java.io.StringReader; @@ -558,7 +558,7 @@ public class NamingProxy { this.serverPort = serverPort; String sp = System.getProperty(SystemPropertyKeyConst.NAMING_SERVER_PORT); - if (com.alibaba.nacos.client.utils.StringUtils.isNotBlank(sp)) { + if (StringUtils.isNotBlank(sp)) { this.serverPort = Integer.parseInt(sp); } } diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/utils/IoUtils.java b/client/src/main/java/com/alibaba/nacos/client/naming/utils/IoUtils.java index b4a5afdde..b1011eee1 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/utils/IoUtils.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/utils/IoUtils.java @@ -16,7 +16,7 @@ package com.alibaba.nacos.client.naming.utils; -import com.alibaba.nacos.client.utils.StringUtils; +import org.apache.commons.lang3.StringUtils; import java.io.*; import java.nio.channels.FileChannel; diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/utils/NetUtils.java b/client/src/main/java/com/alibaba/nacos/client/naming/utils/NetUtils.java index e192e577c..db077df0b 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/utils/NetUtils.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/utils/NetUtils.java @@ -15,7 +15,7 @@ */ package com.alibaba.nacos.client.naming.utils; -import com.alibaba.nacos.client.utils.StringUtils; +import org.apache.commons.lang3.StringUtils; import java.net.InetAddress; import java.net.UnknownHostException; diff --git a/client/src/main/java/com/alibaba/nacos/client/utils/ParamUtil.java b/client/src/main/java/com/alibaba/nacos/client/utils/ParamUtil.java index 9145fa662..e579f635f 100644 --- a/client/src/main/java/com/alibaba/nacos/client/utils/ParamUtil.java +++ b/client/src/main/java/com/alibaba/nacos/client/utils/ParamUtil.java @@ -157,7 +157,7 @@ public class ParamUtil { || !PATTERN.matcher(endpointUrl).find()) { // skip retrieve from system property and retrieve directly from system env String endpointUrlSource = System.getenv(PropertyKeyConst.SystemEnv.ALIBABA_ALIWARE_ENDPOINT_URL); - if (com.alibaba.nacos.client.utils.StringUtils.isNotBlank(endpointUrlSource)) { + if (StringUtils.isNotBlank(endpointUrlSource)) { endpointUrl = endpointUrlSource; } @@ -182,8 +182,8 @@ public class ParamUtil { }); - if (com.alibaba.nacos.client.utils.StringUtils.isBlank(endpointUrlSource)) { - if (com.alibaba.nacos.client.utils.StringUtils.isNotBlank(defaultEndpointUrl)) { + if (StringUtils.isBlank(endpointUrlSource)) { + if (StringUtils.isNotBlank(defaultEndpointUrl)) { endpointUrl = defaultEndpointUrl; } } else { diff --git a/client/src/main/java/com/alibaba/nacos/client/utils/StringUtils.java b/client/src/main/java/com/alibaba/nacos/client/utils/StringUtils.java index 975cf97f9..5241be6da 100644 --- a/client/src/main/java/com/alibaba/nacos/client/utils/StringUtils.java +++ b/client/src/main/java/com/alibaba/nacos/client/utils/StringUtils.java @@ -25,7 +25,9 @@ import java.util.Locale; * string util * * @author Nacos + * @deprecated Use {@link org.apache.commons.lang3.StringUtils} instead */ +@Deprecated public class StringUtils { private static final int INDEX_NOT_FOUND = -1; diff --git a/client/src/test/java/com/alibaba/nacos/client/StringUtilsTest.java b/client/src/test/java/com/alibaba/nacos/client/StringUtilsTest.java index bcc16b939..2b8a7027e 100644 --- a/client/src/test/java/com/alibaba/nacos/client/StringUtilsTest.java +++ b/client/src/test/java/com/alibaba/nacos/client/StringUtilsTest.java @@ -9,6 +9,7 @@ import java.util.Collection; import static org.junit.Assert.*; import static com.alibaba.nacos.client.utils.StringUtils.*; +@Deprecated public class StringUtilsTest { @Test diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/LocalDataSourceServiceImpl.java b/config/src/main/java/com/alibaba/nacos/config/server/service/LocalDataSourceServiceImpl.java index 0786ed4bb..0e0e637fc 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/LocalDataSourceServiceImpl.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/LocalDataSourceServiceImpl.java @@ -18,8 +18,8 @@ package com.alibaba.nacos.config.server.service; import com.alibaba.nacos.config.server.constant.Constants; import com.alibaba.nacos.config.server.utils.LogUtil; import com.alibaba.nacos.config.server.utils.PropertyUtil; -import com.alibaba.nacos.config.server.utils.StringUtils; import org.apache.commons.dbcp.BasicDataSource; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/dump/DumpTask.java b/config/src/main/java/com/alibaba/nacos/config/server/service/dump/DumpTask.java index 2c93dacb1..138b0ff03 100755 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/dump/DumpTask.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/dump/DumpTask.java @@ -29,7 +29,7 @@ import com.alibaba.nacos.config.server.service.trace.ConfigTraceService; import com.alibaba.nacos.config.server.utils.GroupKey2; import com.alibaba.nacos.config.server.utils.LogUtil; import com.alibaba.nacos.config.server.utils.MD5; -import com.alibaba.nacos.config.server.utils.StringUtils; +import org.apache.commons.lang3.StringUtils; import java.sql.Timestamp; import java.util.List; diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/merge/MergeTaskProcessor.java b/config/src/main/java/com/alibaba/nacos/config/server/service/merge/MergeTaskProcessor.java index 8b63d8d10..d151a5a17 100755 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/merge/MergeTaskProcessor.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/merge/MergeTaskProcessor.java @@ -25,9 +25,9 @@ import com.alibaba.nacos.config.server.service.ConfigDataChangeEvent; import com.alibaba.nacos.config.server.service.PersistService; import com.alibaba.nacos.config.server.service.trace.ConfigTraceService; import com.alibaba.nacos.config.server.utils.ContentUtils; -import com.alibaba.nacos.config.server.utils.StringUtils; import com.alibaba.nacos.config.server.utils.TimeUtils; import com.alibaba.nacos.config.server.utils.event.EventDispatcher; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/notify/AsyncNotifyService.java b/config/src/main/java/com/alibaba/nacos/config/server/service/notify/AsyncNotifyService.java index 5df6ef3ab..a6bad3e03 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/notify/AsyncNotifyService.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/notify/AsyncNotifyService.java @@ -23,9 +23,9 @@ import com.alibaba.nacos.config.server.service.trace.ConfigTraceService; import com.alibaba.nacos.config.server.utils.LogUtil; import com.alibaba.nacos.config.server.utils.PropertyUtil; import com.alibaba.nacos.config.server.utils.RunningConfigUtils; -import com.alibaba.nacos.config.server.utils.StringUtils; import com.alibaba.nacos.config.server.utils.event.EventDispatcher.AbstractEventListener; import com.alibaba.nacos.config.server.utils.event.EventDispatcher.Event; +import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.client.config.RequestConfig; diff --git a/config/src/main/java/com/alibaba/nacos/config/server/utils/AppNameUtils.java b/config/src/main/java/com/alibaba/nacos/config/server/utils/AppNameUtils.java index d27f29594..4877c030c 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/utils/AppNameUtils.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/utils/AppNameUtils.java @@ -15,6 +15,8 @@ */ package com.alibaba.nacos.config.server.utils; +import org.apache.commons.lang3.StringUtils; + import java.io.File; /** diff --git a/config/src/main/java/com/alibaba/nacos/config/server/utils/GroupKey.java b/config/src/main/java/com/alibaba/nacos/config/server/utils/GroupKey.java index 4b10b1946..7ba66ae7e 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/utils/GroupKey.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/utils/GroupKey.java @@ -15,6 +15,8 @@ */ package com.alibaba.nacos.config.server.utils; +import org.apache.commons.lang3.StringUtils; + /** * 合成dataId+groupId的形式。对dataId和groupId中的保留字符做转义。 * diff --git a/config/src/main/java/com/alibaba/nacos/config/server/utils/GroupKey2.java b/config/src/main/java/com/alibaba/nacos/config/server/utils/GroupKey2.java index 8f0c7d301..4e0c86f6b 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/utils/GroupKey2.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/utils/GroupKey2.java @@ -15,6 +15,8 @@ */ package com.alibaba.nacos.config.server.utils; +import org.apache.commons.lang3.StringUtils; + /** * Group key util * diff --git a/config/src/main/java/com/alibaba/nacos/config/server/utils/RequestUtil.java b/config/src/main/java/com/alibaba/nacos/config/server/utils/RequestUtil.java index 2f293eeeb..08e50b1fd 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/utils/RequestUtil.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/utils/RequestUtil.java @@ -15,6 +15,8 @@ */ package com.alibaba.nacos.config.server.utils; +import org.apache.commons.lang3.StringUtils; + import javax.servlet.http.HttpServletRequest; /** diff --git a/config/src/main/java/com/alibaba/nacos/config/server/utils/StringUtils.java b/config/src/main/java/com/alibaba/nacos/config/server/utils/StringUtils.java deleted file mode 100644 index 7c491ca80..000000000 --- a/config/src/main/java/com/alibaba/nacos/config/server/utils/StringUtils.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.nacos.config.server.utils; - -/** - * 替代common-lang中类,减少依赖 - * - * @author Nacos - */ -public class StringUtils { - - public static final int INDEX_NOT_FOUND = -1; - - public static boolean isBlank(String str) { - int strLen; - if (str == null || (strLen = str.length()) == 0) { - return true; - } - for (int i = 0; i < strLen; i++) { - if ((Character.isWhitespace(str.charAt(i)) == false)) { - return false; - } - } - return true; - } - - public static boolean isNotEmpty(String str) { - return !StringUtils.isEmpty(str); - } - - public static boolean isEmpty(String str) { - return str == null || str.length() == 0; - } - - public static String defaultIfEmpty(String str, String defaultStr) { - return StringUtils.isEmpty(str) ? defaultStr : str; - } - - public static boolean equals(String str1, String str2) { - return str1 == null ? str2 == null : str1.equals(str2); - } - - public static String substringBetween(String str, String open, String close) { - if (str == null || open == null || close == null) { - return null; - } - int start = str.indexOf(open); - if (start != INDEX_NOT_FOUND) { - int end = str.indexOf(close, start + open.length()); - if (end != INDEX_NOT_FOUND) { - return str.substring(start + open.length(), end); - } - } - return null; - } -} diff --git a/console/src/main/java/com/alibaba/nacos/console/controller/NamespaceController.java b/console/src/main/java/com/alibaba/nacos/console/controller/NamespaceController.java index a6250e576..b7ec2611b 100644 --- a/console/src/main/java/com/alibaba/nacos/console/controller/NamespaceController.java +++ b/console/src/main/java/com/alibaba/nacos/console/controller/NamespaceController.java @@ -19,9 +19,9 @@ import com.alibaba.nacos.api.exception.NacosException; import com.alibaba.nacos.config.server.model.RestResult; import com.alibaba.nacos.config.server.model.TenantInfo; import com.alibaba.nacos.config.server.service.PersistService; -import com.alibaba.nacos.config.server.utils.StringUtils; import com.alibaba.nacos.console.model.Namespace; import com.alibaba.nacos.console.model.NamespaceAllInfo; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping;