Consistent use of StringUtils.hasLength(String) vs isEmpty(Object)

This commit is contained in:
Juergen Hoeller
2019-05-03 17:29:14 +02:00
parent 84266d71e9
commit a7949ac84a
18 changed files with 49 additions and 42 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -420,7 +420,7 @@ public class SubProtocolWebSocketHandler
}
SubProtocolHandler handler;
if (!StringUtils.isEmpty(protocol)) {
if (StringUtils.hasLength(protocol)) {
handler = this.protocolHandlerLookup.get(protocol);
if (handler == null) {
throw new IllegalStateException(

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -118,7 +118,7 @@ public abstract class AbstractHttpSendingTransportHandler extends AbstractTransp
String query = request.getURI().getQuery();
MultiValueMap<String, String> params = UriComponentsBuilder.newInstance().query(query).build().getQueryParams();
String value = params.getFirst("c");
if (StringUtils.isEmpty(value)) {
if (!StringUtils.hasLength(value)) {
return null;
}
String result = UriUtils.decode(value, StandardCharsets.UTF_8);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -179,7 +179,7 @@ public class WebSocketServerSockJsSession extends AbstractSockJsSession implemen
public void handleMessage(TextMessage message, WebSocketSession wsSession) throws Exception {
String payload = message.getPayload();
if (StringUtils.isEmpty(payload)) {
if (!StringUtils.hasLength(payload)) {
return;
}
String[] messages;