[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

@@ -64,8 +64,7 @@ public class SmartthingsHandlerFactory extends BaseThingHandlerFactory implement
private @Nullable SmartthingsBridgeHandler bridgeHandler = null;
private @Nullable ThingUID bridgeUID;
private Gson gson;
private List<SmartthingsThingHandler> thingHandlers = Collections
.synchronizedList(new ArrayList<SmartthingsThingHandler>());
private List<SmartthingsThingHandler> thingHandlers = Collections.synchronizedList(new ArrayList<>());
private @NonNullByDefault({}) HttpClient httpClient;
@@ -153,6 +152,9 @@ public class SmartthingsHandlerFactory extends BaseThingHandlerFactory implement
String data = (String) event.getProperty("data");
SmartthingsStateData stateData = new SmartthingsStateData();
stateData = gson.fromJson(data, stateData.getClass());
if (stateData == null) {
return;
}
SmartthingsThingHandler handler = findHandler(stateData);
if (handler != null) {
handler.handleStateMessage(stateData);

View File

@@ -12,10 +12,7 @@
*/
package org.openhab.binding.smartthings.internal.discovery;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
@@ -166,11 +163,11 @@ public class SmartthingsDiscoveryService extends AbstractDiscoveryService implem
// The data returned from the Smartthings hub is a list of strings where each
// element is the data for one device. That device string is another json object
List<String> devices = new ArrayList<String>();
List<String> devices = new ArrayList<>();
devices = gson.fromJson(data, devices.getClass());
for (String device : devices) {
SmartthingsDeviceData deviceData = gson.fromJson(device, SmartthingsDeviceData.class);
createDevice(deviceData);
createDevice(Objects.requireNonNull(deviceData));
}
}