Rework more commons-lang usages (#10314)

* Reworks many commons-lang usages to use standard Java
* Updates all remaining commons.lang imports to commons.lang3

Related to openhab/openhab-addons#7722

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born
2021-03-16 12:38:16 +01:00
committed by GitHub
parent 16fba31556
commit f3503430b4
257 changed files with 906 additions and 1125 deletions

View File

@@ -32,7 +32,6 @@ import java.util.concurrent.TimeUnit;
import javax.measure.Unit;
import javax.measure.quantity.Temperature;
import org.apache.commons.lang.StringUtils;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jetty.client.HttpClient;
@@ -268,7 +267,7 @@ public class IAqualinkHandler extends BaseThingHandler {
String confSerialId = configuration.serialId;
String confApiKey = configuration.apiKey;
if (StringUtils.isNotBlank(confApiKey)) {
if (confApiKey != null && !confApiKey.isBlank()) {
this.apiKey = confApiKey;
} else {
this.apiKey = DEFAULT_API_KEY;
@@ -291,7 +290,7 @@ public class IAqualinkHandler extends BaseThingHandler {
return;
}
if (StringUtils.isNotBlank(confSerialId)) {
if (confSerialId != null && !confSerialId.isBlank()) {
serialNumber = confSerialId.replaceAll("[^a-zA-Z0-9]", "").toLowerCase();
if (!Arrays.stream(devices).anyMatch(device -> device.getSerialNumber().equals(serialNumber))) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
@@ -438,8 +437,7 @@ public class IAqualinkHandler extends BaseThingHandler {
*/
private State toState(String name, @Nullable String type, @Nullable String value) {
try {
// @nullable checker does not recognize isBlank as checking null here, so must use == null to make happy
if (value == null || StringUtils.isBlank(value)) {
if (value == null || value.isBlank()) {
return UnDefType.UNDEF;
}