[flicbutton] Fix SAT @NonNull findings (#12334)
Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
parent
cabcaa9698
commit
00e16f5b4e
@ -14,7 +14,6 @@ package org.openhab.binding.flicbutton.internal.discovery;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNull;
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
import org.openhab.binding.flicbutton.internal.FlicButtonBindingConstants;
|
import org.openhab.binding.flicbutton.internal.FlicButtonBindingConstants;
|
||||||
@ -94,7 +93,7 @@ public class FlicSimpleclientDiscoveryServiceImpl extends AbstractDiscoveryServi
|
|||||||
boolean currentlyNoSpaceForNewConnection, Bdaddr @Nullable [] verifiedButtons) throws IOException {
|
boolean currentlyNoSpaceForNewConnection, Bdaddr @Nullable [] verifiedButtons) throws IOException {
|
||||||
for (final @Nullable Bdaddr bdaddr : verifiedButtons) {
|
for (final @Nullable Bdaddr bdaddr : verifiedButtons) {
|
||||||
if (bdaddr != null) {
|
if (bdaddr != null) {
|
||||||
flicButtonDiscovered((@NonNull Bdaddr) bdaddr);
|
flicButtonDiscovered(bdaddr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -109,7 +108,7 @@ public class FlicSimpleclientDiscoveryServiceImpl extends AbstractDiscoveryServi
|
|||||||
public void onNewVerifiedButton(@Nullable Bdaddr bdaddr) throws IOException {
|
public void onNewVerifiedButton(@Nullable Bdaddr bdaddr) throws IOException {
|
||||||
logger.debug("A new Flic button was added by an external flicd client: {}", bdaddr);
|
logger.debug("A new Flic button was added by an external flicd client: {}", bdaddr);
|
||||||
if (bdaddr != null) {
|
if (bdaddr != null) {
|
||||||
flicButtonDiscovered((@NonNull Bdaddr) bdaddr);
|
flicButtonDiscovered(bdaddr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -15,7 +15,6 @@ package org.openhab.binding.flicbutton.internal.handler;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.concurrent.Semaphore;
|
import java.util.concurrent.Semaphore;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNull;
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
import org.openhab.binding.flicbutton.internal.FlicButtonBindingConstants;
|
import org.openhab.binding.flicbutton.internal.FlicButtonBindingConstants;
|
||||||
@ -58,7 +57,7 @@ public class FlicButtonEventListener extends ButtonConnectionChannel.Callbacks {
|
|||||||
logger.debug("Create response {}: {}, {}", channel.getBdaddr(), createConnectionChannelError, connectionStatus);
|
logger.debug("Create response {}: {}, {}", channel.getBdaddr(), createConnectionChannelError, connectionStatus);
|
||||||
// Handling does not differ from Status change, so redirect
|
// Handling does not differ from Status change, so redirect
|
||||||
if (connectionStatus != null) {
|
if (connectionStatus != null) {
|
||||||
thingHandler.initializeStatus((@NonNull ConnectionStatus) connectionStatus);
|
thingHandler.initializeStatus(connectionStatus);
|
||||||
channelResponseSemaphore.release();
|
channelResponseSemaphore.release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -76,7 +75,7 @@ public class FlicButtonEventListener extends ButtonConnectionChannel.Callbacks {
|
|||||||
logger.trace("New status for {}: {}", channel.getBdaddr(),
|
logger.trace("New status for {}: {}", channel.getBdaddr(),
|
||||||
connectionStatus + (connectionStatus == ConnectionStatus.Disconnected ? ", " + disconnectReason : ""));
|
connectionStatus + (connectionStatus == ConnectionStatus.Disconnected ? ", " + disconnectReason : ""));
|
||||||
if (connectionStatus != null) {
|
if (connectionStatus != null) {
|
||||||
thingHandler.connectionStatusChanged((@NonNull ConnectionStatus) connectionStatus, disconnectReason);
|
thingHandler.connectionStatusChanged(connectionStatus, disconnectReason);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,8 +96,7 @@ public class FlicButtonEventListener extends ButtonConnectionChannel.Callbacks {
|
|||||||
@Nullable ClickType clickType, boolean wasQueued, int timeDiff) throws IOException {
|
@Nullable ClickType clickType, boolean wasQueued, int timeDiff) throws IOException {
|
||||||
// Handling does not differ from up/down events, so redirect
|
// Handling does not differ from up/down events, so redirect
|
||||||
if (channel != null && clickType != null) {
|
if (channel != null && clickType != null) {
|
||||||
onButtonUpOrDown((@NonNull ButtonConnectionChannel) channel, (@NonNull ClickType) clickType, wasQueued,
|
onButtonUpOrDown(channel, clickType, wasQueued, timeDiff);
|
||||||
timeDiff);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,7 +19,6 @@ import java.util.Collection;
|
|||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNull;
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
import org.openhab.binding.flicbutton.internal.discovery.FlicButtonDiscoveryService;
|
import org.openhab.binding.flicbutton.internal.discovery.FlicButtonDiscoveryService;
|
||||||
@ -87,8 +86,9 @@ public class FlicDaemonBridgeHandler extends BaseBridgeHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void activateButtonDiscoveryService() {
|
private void activateButtonDiscoveryService() {
|
||||||
|
FlicClient flicClient = this.flicClient;
|
||||||
if (flicClient != null) {
|
if (flicClient != null) {
|
||||||
buttonDiscoveryService.activate((@NonNull FlicClient) flicClient);
|
buttonDiscoveryService.activate(flicClient);
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException("flicClient not properly initialized");
|
throw new IllegalStateException("flicClient not properly initialized");
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user