[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:
@@ -63,7 +63,7 @@ public abstract class CommandHandler {
|
||||
/**
|
||||
* Implements what to do when an openHAB command is received
|
||||
*
|
||||
* @param config the configuration for the item that generated the command
|
||||
* @param conf the configuration for the item that generated the command
|
||||
* @param cmd the openhab command issued
|
||||
* @param device the Insteon device to which this command applies
|
||||
*/
|
||||
|
||||
@@ -16,11 +16,7 @@ import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
@@ -440,8 +436,7 @@ public class DeviceFeature {
|
||||
static {
|
||||
// read features from xml file and store them in a map
|
||||
InputStream input = DeviceFeature.class.getResourceAsStream("/device_features.xml");
|
||||
if (input != null) {
|
||||
readFeatureTemplates(input);
|
||||
}
|
||||
Objects.requireNonNull(input);
|
||||
readFeatureTemplates(input);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class DeviceTypeLoader {
|
||||
* Reads the device types from input stream and stores them in memory for
|
||||
* later access.
|
||||
*
|
||||
* @param is the input stream from which to read
|
||||
* @param in the input stream from which to read
|
||||
*/
|
||||
public void loadDeviceTypesXML(InputStream in) throws ParserConfigurationException, SAXException, IOException {
|
||||
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
|
||||
@@ -204,20 +204,18 @@ public class DeviceTypeLoader {
|
||||
public static synchronized DeviceTypeLoader instance() {
|
||||
if (deviceTypeLoader.getDeviceTypes().isEmpty()) {
|
||||
InputStream input = DeviceTypeLoader.class.getResourceAsStream("/device_types.xml");
|
||||
if (input != null) {
|
||||
try {
|
||||
try {
|
||||
if (input != null) {
|
||||
deviceTypeLoader.loadDeviceTypesXML(input);
|
||||
} catch (ParserConfigurationException e) {
|
||||
logger.warn("parser config error when reading device types xml file: ", e);
|
||||
} catch (SAXException e) {
|
||||
logger.warn("SAX exception when reading device types xml file: ", e);
|
||||
} catch (IOException e) {
|
||||
logger.warn("I/O exception when reading device types xml file: ", e);
|
||||
} else {
|
||||
logger.warn("Resource stream is null, cannot read xml file.");
|
||||
}
|
||||
logger.debug("loaded {} devices: ", deviceTypeLoader.getDeviceTypes().size());
|
||||
deviceTypeLoader.logDeviceTypes();
|
||||
} else {
|
||||
logger.warn("unable to get device types xml file as a resource");
|
||||
} catch (ParserConfigurationException e) {
|
||||
logger.warn("parser config error when reading device types xml file: ", e);
|
||||
} catch (SAXException e) {
|
||||
logger.warn("SAX exception when reading device types xml file: ", e);
|
||||
} catch (IOException e) {
|
||||
logger.warn("I/O exception when reading device types xml file: ", e);
|
||||
}
|
||||
}
|
||||
return deviceTypeLoader;
|
||||
|
||||
@@ -14,13 +14,7 @@ package org.openhab.binding.insteon.internal.handler;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -185,7 +179,7 @@ public class InsteonDeviceHandler extends BaseThingHandler {
|
||||
Type mapType = new TypeToken<Map<String, Object>>() {
|
||||
}.getType();
|
||||
try {
|
||||
deviceConfigMap = new Gson().fromJson(deviceConfig, mapType);
|
||||
deviceConfigMap = Objects.requireNonNull(new Gson().fromJson(deviceConfig, mapType));
|
||||
} catch (JsonParseException e) {
|
||||
String msg = "The device configuration parameter is not valid JSON.";
|
||||
logger.warn("{} {}", thing.getUID().getAsString(), msg);
|
||||
|
||||
Reference in New Issue
Block a user