fix null type in model.thing generic item channel link provider (#1864)

required '@NonNull Collection<?>' but this expression has type '@Nullable Set<@NonNull String>'

Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
This commit is contained in:
Markus Rathgeb
2020-11-30 10:26:56 +01:00
committed by GitHub
parent 575f744a43
commit 7885aa3526
@@ -16,6 +16,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
@@ -119,21 +120,21 @@ public class GenericItemChannelLinkProvider extends AbstractProvider<ItemChannel
@Override
public void stopConfigurationUpdate(String context) {
if (previousItemNames != null) {
for (String itemName : previousItemNames) {
// we remove all binding configurations that were not processed
Set<ItemChannelLink> links = itemChannelLinkMap.remove(itemName);
if (links != null) {
for (ItemChannelLink removedItemChannelLink : links) {
notifyListenersAboutRemovedElement(removedItemChannelLink);
}
final Set<String> previousItemNames = this.previousItemNames;
this.previousItemNames = null;
if (previousItemNames == null) {
return;
}
for (String itemName : previousItemNames) {
// we remove all binding configurations that were not processed
Set<ItemChannelLink> links = itemChannelLinkMap.remove(itemName);
if (links != null) {
for (ItemChannelLink removedItemChannelLink : links) {
notifyListenersAboutRemovedElement(removedItemChannelLink);
}
}
if (contextMap.get(context) != null) {
contextMap.get(context).removeAll(previousItemNames);
}
previousItemNames = null;
}
Optional.ofNullable(contextMap.get(context)).ifPresent(ctx -> ctx.removeAll(previousItemNames));
}
@Override