[infrastructure] add external null-annotations (#8848)

Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
J-N-K
2020-10-31 00:29:03 +01:00
committed by GitHub
parent 47d05055db
commit bd664ff0c8
162 changed files with 933 additions and 575 deletions

View File

@@ -697,9 +697,10 @@ public class AccountServlet extends HttpServlet {
}
}
void returnError(HttpServletResponse resp, String errorMessage) {
void returnError(HttpServletResponse resp, @Nullable String errorMessage) {
try {
resp.getWriter().write("<html>" + StringEscapeUtils.escapeHtml(errorMessage) + "<br><a href='" + servletUrl
String message = errorMessage != null ? errorMessage : "null";
resp.getWriter().write("<html>" + StringEscapeUtils.escapeHtml(message) + "<br><a href='" + servletUrl
+ "'>Try again</a></html>");
} catch (IOException e) {
logger.info("Returning error message failed", e);

View File

@@ -32,6 +32,7 @@ import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.amazonechocontrol.internal.Connection;
import org.openhab.binding.amazonechocontrol.internal.handler.AccountHandler;
import org.openhab.binding.amazonechocontrol.internal.handler.SmartHomeDeviceHandler;
import org.openhab.binding.amazonechocontrol.internal.jsons.JsonSmartHomeCapabilities;
import org.openhab.binding.amazonechocontrol.internal.jsons.JsonSmartHomeDevices.DriverIdentity;
import org.openhab.binding.amazonechocontrol.internal.jsons.JsonSmartHomeDevices.SmartHomeDevice;
import org.openhab.binding.amazonechocontrol.internal.jsons.JsonSmartHomeGroups.SmartHomeGroup;
@@ -171,7 +172,8 @@ public class SmartHomeDevicesDiscovery extends AbstractDiscoveryService {
continue;
}
if (Stream.of(shd.capabilities).noneMatch(capability -> capability != null
JsonSmartHomeCapabilities.SmartHomeCapability[] capabilities = shd.capabilities;
if (capabilities == null || Stream.of(capabilities).noneMatch(capability -> capability != null
&& Constants.SUPPORTED_INTERFACES.contains(capability.interfaceName))) {
// No supported interface found
continue;

View File

@@ -109,7 +109,8 @@ public class SmartHomeDeviceHandler extends BaseThingHandler {
}
}
if (handler != null) {
Collection<ChannelInfo> required = handler.initialize(this, capabilities.get(interfaceName));
Collection<ChannelInfo> required = handler.initialize(this,
capabilities.getOrDefault(interfaceName, Collections.emptyList()));
for (ChannelInfo channelInfo : required) {
unusedChannels.remove(channelInfo.channelId);
if (addChannelToDevice(thingBuilder, channelInfo.channelId, channelInfo.itemType,