[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

@@ -262,7 +262,7 @@ public class UpnpXMLParser {
@Override
public void characters(char @Nullable [] ch, int start, int length) throws SAXException {
Element el = element;
if (el == null) {
if (el == null || ch == null) {
return;
}
switch (el) {

View File

@@ -165,12 +165,12 @@ public abstract class UpnpHandler extends BaseThingHandler implements UpnpIOPart
@Override
public void onValueReceived(@Nullable String variable, @Nullable String value, @Nullable String service) {
if (variable == null) {
if (variable == null || value == null) {
return;
}
switch (variable) {
case "CurrentTransportState":
if (!((value == null) || (value.isEmpty()))) {
if (!value.isEmpty()) {
transportState = value;
}
break;

View File

@@ -590,7 +590,7 @@ public class UpnpRendererHandler extends UpnpHandler {
playing = true;
updateState(CONTROL, PlayPauseType.PLAY);
scheduleTrackPositionRefresh();
} else if ("PAUSED_PLAYBACK".contentEquals(value)) {
} else if ("PAUSED_PLAYBACK".equals(value)) {
updateState(CONTROL, PlayPauseType.PAUSE);
}
break;

View File

@@ -207,7 +207,13 @@ public class UpnpServerHandler extends UpnpHandler {
// No parent found, so make it the root directory
browseTarget = DIRECTORY_ROOT;
}
currentEntry = parentMap.get(browseTarget);
UpnpEntry entry = parentMap.get(browseTarget);
if (entry == null) {
logger.info("Browse target not found. Exiting.");
return;
}
currentEntry = entry;
}
updateState(CURRENTID, StringType.valueOf(currentEntry.getId()));
logger.debug("Browse target {}", browseTarget);
@@ -349,8 +355,8 @@ public class UpnpServerHandler extends UpnpHandler {
}
/**
* Method that does a UPnP browse on a content directory. Results will be retrieved in the {@link onValueReceived}
* method.
* Method that does a UPnP browse on a content directory. Results will be retrieved in the
* {@link #onValueReceived(String, String, String)} method.
*
* @param objectID content directory object
* @param browseFlag BrowseMetaData or BrowseDirectChildren
@@ -373,8 +379,8 @@ public class UpnpServerHandler extends UpnpHandler {
}
/**
* Method that does a UPnP search on a content directory. Results will be retrieved in the {@link onValueReceived}
* method.
* Method that does a UPnP search on a content directory. Results will be retrieved in the
* {@link #onValueReceived(String, String, String)} method.
*
* @param containerID content directory container
* @param searchCriteria search criteria, examples: