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

@@ -12,8 +12,6 @@
*/
package org.openhab.binding.meteoblue.internal;
import org.apache.commons.lang.StringUtils;
/**
* Model for the meteoblue binding configuration.
*
@@ -64,15 +62,15 @@ public class MeteoBlueConfiguration {
String a2 = split.length > 1 ? split[1] : null;
String a3 = split.length > 2 ? split[2] : null;
if (!StringUtils.isBlank(a1)) {
if (a1 != null && !a1.isBlank()) {
latitude = tryGetDouble(a1);
}
if (!StringUtils.isBlank(a2)) {
if (a2 != null && !a2.isBlank()) {
longitude = tryGetDouble(a2);
}
if (!StringUtils.isBlank(a3)) {
if (a3 != null && !a3.isBlank()) {
altitude = tryGetDouble(a3);
}
}

View File

@@ -17,7 +17,6 @@ import static org.openhab.binding.meteoblue.internal.MeteoBlueBindingConstants.T
import java.util.Collections;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.openhab.binding.meteoblue.internal.MeteoBlueBridgeConfig;
import org.openhab.core.io.net.http.HttpUtil;
import org.openhab.core.thing.Bridge;
@@ -55,7 +54,7 @@ public class MeteoBlueBridgeHandler extends BaseBridgeHandler {
MeteoBlueBridgeConfig config = getConfigAs(MeteoBlueBridgeConfig.class);
String apiKeyTemp = config.getApiKey();
if (StringUtils.isBlank(apiKeyTemp)) {
if (apiKeyTemp == null || apiKeyTemp.isBlank()) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
"Cannot initialize meteoblue bridge. No apiKey provided.");
return;

View File

@@ -27,7 +27,6 @@ import java.util.concurrent.TimeUnit;
import javax.imageio.ImageIO;
import org.apache.commons.lang.StringUtils;
import org.openhab.binding.meteoblue.internal.Forecast;
import org.openhab.binding.meteoblue.internal.MeteoBlueConfiguration;
import org.openhab.binding.meteoblue.internal.json.JsonData;
@@ -97,13 +96,13 @@ public class MeteoBlueHandler extends BaseThingHandler {
MeteoBlueConfiguration config = getConfigAs(MeteoBlueConfiguration.class);
if (StringUtils.isBlank(config.serviceType)) {
if (config.serviceType == null || config.serviceType.isBlank()) {
config.serviceType = MeteoBlueConfiguration.SERVICETYPE_NONCOMM;
logger.debug("Using default service type ({}).", config.serviceType);
return;
}
if (StringUtils.isBlank(config.location)) {
if (config.location == null || config.location.isBlank()) {
flagBadConfig("The location was not configured.");
return;
}
@@ -315,7 +314,7 @@ public class MeteoBlueHandler extends BaseThingHandler {
if (config.altitude != null) {
builder.append("&asl=" + config.altitude);
}
if (StringUtils.isNotBlank(config.timeZone)) {
if (config.timeZone != null && !config.timeZone.isBlank()) {
builder.append("&tz=" + config.timeZone);
}
url = url.replace("#FORMAT_PARAMS#", builder.toString());