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

@@ -26,7 +26,7 @@ import java.util.Properties;
import java.util.Set;
import java.util.concurrent.TimeoutException;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jetty.client.HttpClient;

View File

@@ -18,8 +18,7 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jetty.client.HttpClient;
@@ -133,8 +132,9 @@ public class EcobeeAuth {
logger.debug("EcobeeAuth: Got null authorize response from Ecobee API");
setState(EcobeeAuthState.NEED_PIN);
} else {
if (StringUtils.isNotEmpty(authResponse.error)) {
throw new EcobeeAuthException(authResponse.error + ": " + authResponse.errorDescription);
String error = authResponse.error;
if (error != null && !error.isEmpty()) {
throw new EcobeeAuthException(error + ": " + authResponse.errorDescription);
}
code = authResponse.code;
writeLogMessage(authResponse.pin, authResponse.expiresIn);
@@ -172,8 +172,9 @@ public class EcobeeAuth {
setState(isPinExpired() ? EcobeeAuthState.NEED_PIN : EcobeeAuthState.NEED_TOKEN);
return;
}
if (StringUtils.isNotEmpty(tokenResponse.error)) {
throw new EcobeeAuthException(tokenResponse.error + ": " + tokenResponse.errorDescription);
String error = tokenResponse.error;
if (error != null && !error.isEmpty()) {
throw new EcobeeAuthException(error + ": " + tokenResponse.errorDescription);
}
AccessTokenResponse accessTokenResponse = new AccessTokenResponse();
accessTokenResponse.setRefreshToken(tokenResponse.refreshToken);

View File

@@ -17,7 +17,7 @@ import static org.openhab.binding.ecobee.internal.EcobeeBindingConstants.*;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.commons.lang.WordUtils;
import org.apache.commons.lang3.text.WordUtils;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.ecobee.internal.config.EcobeeSensorConfiguration;
import org.openhab.binding.ecobee.internal.dto.thermostat.RemoteSensorCapabilityDTO;

View File

@@ -25,7 +25,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
import javax.measure.Unit;
import org.apache.commons.lang.WordUtils;
import org.apache.commons.lang3.text.WordUtils;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.ecobee.internal.action.EcobeeActions;