[infrastructure] move infered nullness warnings to error and update EEA (#8949)

Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
J-N-K
2020-11-12 21:07:11 +01:00
committed by GitHub
parent 0856a0b3f2
commit ba4c96d99d
155 changed files with 644 additions and 632 deletions

View File

@@ -19,7 +19,6 @@ import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang.StringUtils;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
@@ -94,10 +93,9 @@ public class HydrawiseCloudHandler extends HydrawiseHandler {
} else {
// try and use ID from saved property
String controllerId = getThing().getProperties().get(PROPERTY_CONTROLLER_ID);
if (StringUtils.isNotBlank(controllerId)) {
if (controllerId != null && !controllerId.isBlank()) {
try {
controller = getController(Integer.parseInt(controllerId), controllers);
} catch (NumberFormatException e) {
logger.debug("Can not parse property vaue {}", controllerId);
}

View File

@@ -16,10 +16,7 @@ import static org.openhab.binding.hydrawise.internal.HydrawiseBindingConstants.*
import java.time.ZonedDateTime;
import java.time.temporal.ChronoUnit;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.*;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
@@ -127,6 +124,7 @@ public abstract class HydrawiseHandler extends BaseThingHandler {
if (allCommand) {
sendRunAllCommand(((DecimalType) command).intValue());
} else {
Objects.requireNonNull(relay);
sendRunCommand(((DecimalType) command).intValue(), relay);
}
break;
@@ -142,6 +140,7 @@ public abstract class HydrawiseHandler extends BaseThingHandler {
sendStopAllCommand();
}
} else {
Objects.requireNonNull(relay);
if (command == OnOffType.ON) {
sendRunCommand(relay);
} else {

View File

@@ -12,6 +12,7 @@
*/
package org.openhab.binding.hydrawise.internal.api;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import org.eclipse.jdt.annotation.NonNullByDefault;
@@ -89,7 +90,7 @@ public class HydrawiseCloudApiClient {
public StatusScheduleResponse getStatusSchedule(int controllerId)
throws HydrawiseConnectionException, HydrawiseAuthenticationException {
String json = doGet(String.format(STATUS_SCHEDUE_URL, apiKey, controllerId));
StatusScheduleResponse response = gson.fromJson(json, StatusScheduleResponse.class);
StatusScheduleResponse response = Objects.requireNonNull(gson.fromJson(json, StatusScheduleResponse.class));
throwExceptionIfResponseError(response);
return response;
}
@@ -104,13 +105,13 @@ public class HydrawiseCloudApiClient {
public CustomerDetailsResponse getCustomerDetails()
throws HydrawiseConnectionException, HydrawiseAuthenticationException {
String json = doGet(String.format(CUSTOMER_DETAILS_URL, apiKey));
CustomerDetailsResponse response = gson.fromJson(json, CustomerDetailsResponse.class);
CustomerDetailsResponse response = Objects.requireNonNull(gson.fromJson(json, CustomerDetailsResponse.class));
throwExceptionIfResponseError(response);
return response;
}
/***
* Sets the controller with supplied {@value id} as the current controller
* Sets the controller with supplied {@param id} as the current controller
*
* @param id
* @return SetControllerResponse
@@ -121,7 +122,7 @@ public class HydrawiseCloudApiClient {
public SetControllerResponse setController(int id)
throws HydrawiseConnectionException, HydrawiseAuthenticationException, HydrawiseCommandException {
String json = doGet(String.format(SET_CONTROLLER_URL, apiKey, id));
SetControllerResponse response = gson.fromJson(json, SetControllerResponse.class);
SetControllerResponse response = Objects.requireNonNull(gson.fromJson(json, SetControllerResponse.class));
throwExceptionIfResponseError(response);
if (!response.message.equals("OK")) {
throw new HydrawiseCommandException(response.message);
@@ -271,7 +272,7 @@ public class HydrawiseCloudApiClient {
private String relayCommand(String url)
throws HydrawiseConnectionException, HydrawiseAuthenticationException, HydrawiseCommandException {
String json = doGet(url);
SetZoneResponse response = gson.fromJson(json, SetZoneResponse.class);
SetZoneResponse response = Objects.requireNonNull(gson.fromJson(json, SetZoneResponse.class));
throwExceptionIfResponseError(response);
if ("error".equals(response.messageType)) {
throw new HydrawiseCommandException(response.message);

View File

@@ -13,6 +13,7 @@
package org.openhab.binding.hydrawise.internal.api;
import java.net.URI;
import java.util.Objects;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@@ -95,7 +96,7 @@ public class HydrawiseLocalApiClient {
throws HydrawiseConnectionException, HydrawiseAuthenticationException {
String json = doGet(localGetURL);
LocalScheduleResponse response = gson.fromJson(json, LocalScheduleResponse.class);
return response;
return Objects.requireNonNull(response);
}
/**