mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
Upgrade SAT plugin to 0.16.0 (#16582)
Modify code which leads to build error with new version of SpotBugs. Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
parent
b77172c6bb
commit
df884ac643
@ -24,6 +24,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import java.util.concurrent.TimeoutException;
|
import java.util.concurrent.TimeoutException;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
@ -38,14 +39,14 @@ public abstract class GattSocket<T extends GattMessage, R extends GattMessage> {
|
|||||||
|
|
||||||
private final Deque<MessageProcessor> messageProcessors = new ConcurrentLinkedDeque<>();
|
private final Deque<MessageProcessor> messageProcessors = new ConcurrentLinkedDeque<>();
|
||||||
|
|
||||||
public void registerMessageHandler(MessageHandler<T, R> messageHandler) {
|
public void registerMessageHandler(MessageHandler<@NonNull T, @NonNull R> messageHandler) {
|
||||||
// we need to use a dummy future since ConcurrentHashMap doesn't allow null values
|
// we need to use a dummy future since ConcurrentHashMap doesn't allow null values
|
||||||
messageProcessors.addFirst(new MessageProcessor(messageHandler, COMPLETED_FUTURE));
|
messageProcessors.addFirst(new MessageProcessor(messageHandler, COMPLETED_FUTURE));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract ScheduledExecutorService getScheduler();
|
protected abstract ScheduledExecutorService getScheduler();
|
||||||
|
|
||||||
public void sendMessage(MessageServicer<T, R> messageServicer) {
|
public void sendMessage(MessageServicer<@NonNull T, @NonNull R> messageServicer) {
|
||||||
T message = messageServicer.createMessage();
|
T message = messageServicer.createMessage();
|
||||||
|
|
||||||
CompletableFuture<@Nullable Void> messageFuture = sendMessage(message);
|
CompletableFuture<@Nullable Void> messageFuture = sendMessage(message);
|
||||||
@ -106,10 +107,10 @@ public abstract class GattSocket<T extends GattMessage, R extends GattMessage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class MessageProcessor {
|
private class MessageProcessor {
|
||||||
private MessageHandler<T, R> messageHandler;
|
private MessageHandler<@NonNull T, @NonNull R> messageHandler;
|
||||||
private Future<?> timeoutFuture;
|
private Future<?> timeoutFuture;
|
||||||
|
|
||||||
public MessageProcessor(MessageHandler<T, R> messageHandler, Future<?> timeoutFuture) {
|
public MessageProcessor(MessageHandler<@NonNull T, @NonNull R> messageHandler, Future<?> timeoutFuture) {
|
||||||
this.messageHandler = messageHandler;
|
this.messageHandler = messageHandler;
|
||||||
this.timeoutFuture = timeoutFuture;
|
this.timeoutFuture = timeoutFuture;
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ public class ThingTypeTableGenerator {
|
|||||||
// write actual rows
|
// write actual rows
|
||||||
rows.forEach(row -> {
|
rows.forEach(row -> {
|
||||||
writer.append(writeRow(maxColumns, row, ' ')).append('\n');
|
writer.append(writeRow(maxColumns, row, ' ')).append('\n');
|
||||||
if (row == headerRow) {
|
if (headerRow.equals(row)) {
|
||||||
writer.append(writeRow(maxColumns, new String[] { "", "", "" }, '-')).append('\n');
|
writer.append(writeRow(maxColumns, new String[] { "", "", "" }, '-')).append('\n');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -17,6 +17,7 @@ import static org.openhab.binding.freeboxos.internal.FreeboxOsBindingConstants.B
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
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.freeboxos.internal.api.FreeboxException;
|
import org.openhab.binding.freeboxos.internal.api.FreeboxException;
|
||||||
@ -167,7 +168,8 @@ public class HomeManager extends RestManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public <T> boolean putCommand(int nodeId, int stateSignalId, T value) throws FreeboxException {
|
public <T> boolean putCommand(int nodeId, int stateSignalId, T value) throws FreeboxException {
|
||||||
put(new EndpointValue<>(value), ENDPOINTS_PATH, String.valueOf(nodeId), String.valueOf(stateSignalId));
|
put(new EndpointValue<@NonNull T>(value), ENDPOINTS_PATH, String.valueOf(nodeId),
|
||||||
|
String.valueOf(stateSignalId));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -396,7 +396,7 @@ public class Clip2Bridge implements Closeable {
|
|||||||
@Override
|
@Override
|
||||||
public void onGoAway(@Nullable Session session, @Nullable GoAwayFrame frame) {
|
public void onGoAway(@Nullable Session session, @Nullable GoAwayFrame frame) {
|
||||||
Objects.requireNonNull(session);
|
Objects.requireNonNull(session);
|
||||||
if (http2Session == session) {
|
if (session.equals(http2Session)) {
|
||||||
Thread recreateThread = new Thread(() -> recreateSession());
|
Thread recreateThread = new Thread(() -> recreateSession());
|
||||||
Clip2Bridge.this.recreateThread = recreateThread;
|
Clip2Bridge.this.recreateThread = recreateThread;
|
||||||
recreateThread.start();
|
recreateThread.start();
|
||||||
@ -412,7 +412,7 @@ public class Clip2Bridge implements Closeable {
|
|||||||
public void onPing(@Nullable Session session, @Nullable PingFrame frame) {
|
public void onPing(@Nullable Session session, @Nullable PingFrame frame) {
|
||||||
Objects.requireNonNull(session);
|
Objects.requireNonNull(session);
|
||||||
Objects.requireNonNull(frame);
|
Objects.requireNonNull(frame);
|
||||||
if (http2Session == session) {
|
if (session.equals(http2Session)) {
|
||||||
checkAliveOk();
|
checkAliveOk();
|
||||||
if (!frame.isReply()) {
|
if (!frame.isReply()) {
|
||||||
session.ping(new PingFrame(true), Callback.NOOP);
|
session.ping(new PingFrame(true), Callback.NOOP);
|
||||||
|
@ -221,8 +221,8 @@ public class MqttTopicClassMapperTests {
|
|||||||
"homie/device123", fieldChangedObserverMock, 10);
|
"homie/device123", fieldChangedObserverMock, 10);
|
||||||
assertThat(future.isDone(), is(true));
|
assertThat(future.isDone(), is(true));
|
||||||
|
|
||||||
SubscribeFieldToMQTTtopic field = attributes.subscriptions.stream().filter(f -> f.field.getName() == "state")
|
SubscribeFieldToMQTTtopic field = attributes.subscriptions.stream()
|
||||||
.findFirst().get();
|
.filter(f -> "state".equals(f.field.getName())).findFirst().get();
|
||||||
field.processMessage(field.topic, "garbage".getBytes());
|
field.processMessage(field.topic, "garbage".getBytes());
|
||||||
verify(fieldChangedObserverMock, times(0)).attributeChanged(any(), any(), any(), any(), anyBoolean());
|
verify(fieldChangedObserverMock, times(0)).attributeChanged(any(), any(), any(), any(), anyBoolean());
|
||||||
assertThat(attributes.state.toString(), is("unknown"));
|
assertThat(attributes.state.toString(), is("unknown"));
|
||||||
|
@ -16,6 +16,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.jdt.annotation.NonNull;
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.openhab.binding.omnilink.internal.exceptions.BridgeOfflineException;
|
import org.openhab.binding.omnilink.internal.exceptions.BridgeOfflineException;
|
||||||
import org.openhab.binding.omnilink.internal.handler.OmnilinkBridgeHandler;
|
import org.openhab.binding.omnilink.internal.handler.OmnilinkBridgeHandler;
|
||||||
@ -42,14 +43,14 @@ public class ObjectPropertyRequest<T extends ObjectProperties> implements Iterab
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final OmnilinkBridgeHandler bridgeHandler;
|
private final OmnilinkBridgeHandler bridgeHandler;
|
||||||
private final ObjectPropertyRequests<T> request;
|
private final ObjectPropertyRequests<@NonNull T> request;
|
||||||
private final int objectNumber;
|
private final int objectNumber;
|
||||||
private final int filter1;
|
private final int filter1;
|
||||||
private final int filter2;
|
private final int filter2;
|
||||||
private final int filter3;
|
private final int filter3;
|
||||||
private final int offset;
|
private final int offset;
|
||||||
|
|
||||||
private ObjectPropertyRequest(OmnilinkBridgeHandler bridgeHandler, ObjectPropertyRequests<T> request,
|
private ObjectPropertyRequest(OmnilinkBridgeHandler bridgeHandler, ObjectPropertyRequests<@NonNull T> request,
|
||||||
int objectNumber, int filter1, int filter2, int filter3, int offset) {
|
int objectNumber, int filter1, int filter2, int filter3, int offset) {
|
||||||
this.bridgeHandler = bridgeHandler;
|
this.bridgeHandler = bridgeHandler;
|
||||||
this.request = request;
|
this.request = request;
|
||||||
|
@ -40,7 +40,7 @@ public abstract class AbstractRioHandlerCallback implements RioHandlerCallback {
|
|||||||
@Override
|
@Override
|
||||||
public void removeListener(String channelId, RioHandlerCallbackListener listener) {
|
public void removeListener(String channelId, RioHandlerCallbackListener listener) {
|
||||||
for (ListenerState listenerState : listeners) {
|
for (ListenerState listenerState : listeners) {
|
||||||
if (listenerState.channelId.equals(channelId) && listenerState.listener == listener) {
|
if (listenerState.channelId.equals(channelId) && listener.equals(listenerState.listener)) {
|
||||||
listeners.remove(listenerState);
|
listeners.remove(listenerState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -285,7 +285,7 @@ public class RemoteControllerLegacy extends RemoteController {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isConnected() {
|
public boolean isConnected() {
|
||||||
return socket != null && !socket.isClosed() && socket != null && socket.isConnected();
|
return socket != null && !socket.isClosed() && socket.isConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String createRegistrationPayload(String ip) throws IOException {
|
private String createRegistrationPayload(String ip) throws IOException {
|
||||||
|
@ -15,6 +15,7 @@ package org.openhab.binding.spotify.internal.handler;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
@ -41,9 +42,9 @@ public class SpotifyDynamicStateDescriptionProvider extends BaseDynamicStateDesc
|
|||||||
public void setDevices(ChannelUID channelUID, List<Device> spotifyDevices) {
|
public void setDevices(ChannelUID channelUID, List<Device> spotifyDevices) {
|
||||||
final List<Device> devices = devicesByChannel.get(channelUID);
|
final List<Device> devices = devicesByChannel.get(channelUID);
|
||||||
|
|
||||||
if (devices == null || (spotifyDevices.size() != devices.size()
|
if (devices == null || (spotifyDevices.size() != devices.size() || !spotifyDevices.stream()
|
||||||
|| !spotifyDevices.stream().allMatch(sd -> devices.stream().anyMatch(
|
.allMatch(sd -> devices.stream().anyMatch(d -> Objects.equals(sd.getId(), d.getId())
|
||||||
d -> sd.getId() == d.getId() && d.getName() != null && d.getName().equals(sd.getName()))))) {
|
&& d.getName() != null && d.getName().equals(sd.getName()))))) {
|
||||||
devicesByChannel.put(channelUID, spotifyDevices);
|
devicesByChannel.put(channelUID, spotifyDevices);
|
||||||
setStateOptions(channelUID, spotifyDevices.stream()
|
setStateOptions(channelUID, spotifyDevices.stream()
|
||||||
.map(device -> new StateOption(device.getId(), device.getName())).collect(Collectors.toList()));
|
.map(device -> new StateOption(device.getId(), device.getName())).collect(Collectors.toList()));
|
||||||
|
@ -20,6 +20,7 @@ import java.time.ZonedDateTime;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
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.verisure.internal.DeviceStatusListener;
|
import org.openhab.binding.verisure.internal.DeviceStatusListener;
|
||||||
@ -51,7 +52,7 @@ import com.google.gson.Gson;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@NonNullByDefault
|
@NonNullByDefault
|
||||||
public abstract class VerisureThingHandler<T extends VerisureThingDTO> extends BaseThingHandler
|
public abstract class VerisureThingHandler<@NonNull T extends VerisureThingDTO> extends BaseThingHandler
|
||||||
implements DeviceStatusListener<T> {
|
implements DeviceStatusListener<T> {
|
||||||
|
|
||||||
protected final Logger logger = LoggerFactory.getLogger(VerisureThingHandler.class);
|
protected final Logger logger = LoggerFactory.getLogger(VerisureThingHandler.class);
|
||||||
|
2
pom.xml
2
pom.xml
@ -80,7 +80,7 @@
|
|||||||
<okio.version>3.9.0</okio.version>
|
<okio.version>3.9.0</okio.version>
|
||||||
<gson.version>2.9.1</gson.version>
|
<gson.version>2.9.1</gson.version>
|
||||||
<kotlin.version>1.9.23</kotlin.version>
|
<kotlin.version>1.9.23</kotlin.version>
|
||||||
<sat.version>0.15.0</sat.version>
|
<sat.version>0.16.0</sat.version>
|
||||||
<slf4j.version>2.0.7</slf4j.version>
|
<slf4j.version>2.0.7</slf4j.version>
|
||||||
<spotless.version>2.38.0</spotless.version>
|
<spotless.version>2.38.0</spotless.version>
|
||||||
<!-- Eclipse Java formatter version 4.26+ does not check test files -->
|
<!-- Eclipse Java formatter version 4.26+ does not check test files -->
|
||||||
|
Loading…
Reference in New Issue
Block a user