Remove unused local variables (#10528)

Fixes 26 SAT UnusedLocalVariable findings

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born
2021-04-16 22:35:01 +02:00
committed by GitHub
parent 030329c118
commit b42101addc
20 changed files with 37 additions and 76 deletions

View File

@@ -230,28 +230,27 @@ public abstract class AbstractBrokerHandler extends BaseBridgeHandler implements
* @param topic the topic (as specified during registration)
*/
public final void unregisterDiscoveryListener(MQTTTopicDiscoveryParticipant listener, String topic) {
Map<MQTTTopicDiscoveryParticipant, @Nullable TopicSubscribe> topicListeners = discoveryTopics.compute(topic,
(k, v) -> {
if (v == null) {
logger.warn(
"Tried to unsubscribe {} from discovery topic {} on broker {} but topic not registered at all. Check discovery logic!",
listener, topic, thing.getUID());
return null;
}
v.compute(listener, (l, w) -> {
if (w == null) {
logger.warn(
"Tried to unsubscribe {} from discovery topic {} on broker {} but topic not registered for listener. Check discovery logic!",
listener, topic, thing.getUID());
} else {
w.stop();
logger.trace("Unsubscribed {} from discovery topic {} on broker {}", listener, topic,
thing.getUID());
}
return null;
});
return v.isEmpty() ? null : v;
});
discoveryTopics.compute(topic, (k, v) -> {
if (v == null) {
logger.warn(
"Tried to unsubscribe {} from discovery topic {} on broker {} but topic not registered at all. Check discovery logic!",
listener, topic, thing.getUID());
return null;
}
v.compute(listener, (l, w) -> {
if (w == null) {
logger.warn(
"Tried to unsubscribe {} from discovery topic {} on broker {} but topic not registered for listener. Check discovery logic!",
listener, topic, thing.getUID());
} else {
w.stop();
logger.trace("Unsubscribed {} from discovery topic {} on broker {}", listener, topic,
thing.getUID());
}
return null;
});
return v.isEmpty() ? null : v;
});
}
/**