Replace usage of deprecated StringUtils.isEmpty with !StringUtils.hasLength (#275)

* spring-cloud/spring-cloud-zookeeper#274
This commit is contained in:
Michael Sievers
2020-12-04 15:40:50 +01:00
committed by GitHub
parent d65b9a0310
commit 991cfbf6e4
3 changed files with 4 additions and 4 deletions

View File

@@ -49,7 +49,7 @@ public class ZookeeperConfigBootstrapConfiguration {
@ConditionalOnMissingBean
public ZookeeperConfigProperties zookeeperConfigProperties(Environment env) {
ZookeeperConfigProperties properties = new ZookeeperConfigProperties();
if (StringUtils.isEmpty(properties.getName())) {
if (!StringUtils.hasLength(properties.getName())) {
properties.setName(env.getProperty("spring.application.name", "application"));
}
return properties;

View File

@@ -106,7 +106,7 @@ public class ZookeeperConfigDataLocationResolver implements ConfigDataLocationRe
}
protected List<String> getCustomContexts(UriComponents uriComponents) {
if (StringUtils.isEmpty(uriComponents.getPath())) {
if (!StringUtils.hasLength(uriComponents.getPath())) {
return Collections.emptyList();
}
@@ -134,7 +134,7 @@ public class ZookeeperConfigDataLocationResolver implements ConfigDataLocationRe
.bind(ZookeeperConfigProperties.PREFIX, Bindable.of(ZookeeperConfigProperties.class))
.orElse(new ZookeeperConfigProperties());
if (StringUtils.isEmpty(properties.getName())) {
if (!StringUtils.hasLength(properties.getName())) {
properties.setName(binder.bind("spring.application.name", String.class).orElse("application"));
}

View File

@@ -81,7 +81,7 @@ public class ZookeeperAutoServiceRegistrationTests {
* registration.getServiceId(), service.getId());
* assertEquals("service name was wrong", "myTestService1-FF-something",
* service.getService()); assertFalse("service address must not be empty",
* StringUtils.isEmpty(service.getAddress()));
* !StringUtils.hasLength(service.getAddress()));
* assertEquals("service address must equals hostname from discovery properties",
* discoveryProperties.getHostname(), service.getAddress());
*/