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:
@@ -18,7 +18,6 @@ import java.util.Map;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openhab.binding.zway.internal.config.ZWayBridgeConfiguration;
|
||||
import org.openhab.core.library.types.OnOffType;
|
||||
import org.openhab.core.thing.Bridge;
|
||||
@@ -387,7 +386,8 @@ public class ZWayBridgeHandler extends BaseBridgeHandler implements IZWayApiCall
|
||||
****************************************/
|
||||
|
||||
// Z-Way IP address
|
||||
if (StringUtils.trimToNull(config.getZWayIpAddress()) == null) {
|
||||
String zWayIpAddress = config.getZWayIpAddress();
|
||||
if (zWayIpAddress == null || zWayIpAddress.isBlank()) {
|
||||
config.setZWayIpAddress("localhost"); // default value
|
||||
}
|
||||
|
||||
@@ -397,19 +397,22 @@ public class ZWayBridgeHandler extends BaseBridgeHandler implements IZWayApiCall
|
||||
}
|
||||
|
||||
// Z-Way Protocol
|
||||
if (StringUtils.trimToNull(config.getZWayProtocol()) == null) {
|
||||
String zWayProtocol = config.getZWayProtocol();
|
||||
if (zWayProtocol == null || zWayProtocol.isBlank()) {
|
||||
config.setZWayProtocol("http");
|
||||
}
|
||||
|
||||
// Z-Way Password
|
||||
if (StringUtils.trimToNull(config.getZWayPassword()) == null) {
|
||||
String zWayPassword = config.getZWayPassword();
|
||||
if (zWayPassword == null || zWayPassword.isBlank()) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
|
||||
"The connection to the Z-Way Server can't established, because the Z-Way password is missing. Please set a Z-Way password.");
|
||||
return null;
|
||||
}
|
||||
|
||||
// Z-Way Username
|
||||
if (StringUtils.trimToNull(config.getZWayUsername()) == null) {
|
||||
String zWayUsername = config.getZWayUsername();
|
||||
if (zWayUsername == null || zWayUsername.isBlank()) {
|
||||
config.setZWayUsername("admin"); // default value
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openhab.binding.zway.internal.config.ZWayZAutomationDeviceConfiguration;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.thing.ThingStatus;
|
||||
@@ -140,7 +139,8 @@ public class ZWayZAutomationDeviceHandler extends ZWayDeviceHandler {
|
||||
private ZWayZAutomationDeviceConfiguration loadAndCheckConfiguration() {
|
||||
ZWayZAutomationDeviceConfiguration config = getConfigAs(ZWayZAutomationDeviceConfiguration.class);
|
||||
|
||||
if (StringUtils.trimToNull(config.getDeviceId()) == null) {
|
||||
String deviceId = config.getDeviceId();
|
||||
if (deviceId == null || deviceId.isBlank()) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
|
||||
"Z-Wave device couldn't create, because the device id is missing.");
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user