From 8d23634acb6fbb1fe5348ac0eea391a9c4c78e30 Mon Sep 17 00:00:00 2001 From: Holger Friedrich Date: Sun, 14 Apr 2024 23:40:44 +0200 Subject: [PATCH] Reduce SAT warnings Signed-off-by: Holger Friedrich --- .../main/java/org/openhab/core/audio/PipedAudioStream.java | 2 +- .../discovery/internal/DiscoveryServiceRegistryImpl.java | 1 - .../core/io/rest/core/internal/addons/AddonResource.java | 4 +--- .../org/openhab/core/model/yaml/test/FirstTypeDTO.java | 6 ++++-- .../org/openhab/core/model/yaml/test/SecondTypeDTO.java | 6 ++++-- .../openhab/core/thing/link/ItemChannelLinkRegistry.java | 7 ++++++- 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/PipedAudioStream.java b/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/PipedAudioStream.java index 03b81881b48..a97b612b91e 100644 --- a/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/PipedAudioStream.java +++ b/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/PipedAudioStream.java @@ -87,7 +87,7 @@ public void close() throws IOException { if (closed.getAndSet(true)) { return; } - if (this.onCloseChain.size() > 0) { + if (!this.onCloseChain.isEmpty()) { this.onCloseChain.forEach(Runnable::run); this.onCloseChain.clear(); } diff --git a/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/internal/DiscoveryServiceRegistryImpl.java b/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/internal/DiscoveryServiceRegistryImpl.java index 25963f24c87..0601c3a305c 100644 --- a/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/internal/DiscoveryServiceRegistryImpl.java +++ b/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/internal/DiscoveryServiceRegistryImpl.java @@ -346,7 +346,6 @@ private boolean startScans(Set discoveryServices, @Nullable Sc if (startScan(discoveryServices.iterator().next(), listener)) { atLeastOneDiscoveryServiceHasBeenStarted = true; } - } return atLeastOneDiscoveryServiceHasBeenStarted; diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/addons/AddonResource.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/addons/AddonResource.java index 97a0cac2fe4..121428371bb 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/addons/AddonResource.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/addons/AddonResource.java @@ -169,9 +169,7 @@ public void receive(Event event) { } private boolean lastModifiedIsValid() { - if (lastModified == null) - return false; - return (new Date().getTime() - lastModified.getTime()) <= 450 * 1000; + return (lastModified != null) && ((new Date().getTime() - lastModified.getTime()) <= 450 * 1000); } @GET diff --git a/bundles/org.openhab.core.model.yaml/src/test/java/org/openhab/core/model/yaml/test/FirstTypeDTO.java b/bundles/org.openhab.core.model.yaml/src/test/java/org/openhab/core/model/yaml/test/FirstTypeDTO.java index 736effc0fe4..5d9ddc62c9c 100644 --- a/bundles/org.openhab.core.model.yaml/src/test/java/org/openhab/core/model/yaml/test/FirstTypeDTO.java +++ b/bundles/org.openhab.core.model.yaml/src/test/java/org/openhab/core/model/yaml/test/FirstTypeDTO.java @@ -48,10 +48,12 @@ public boolean isValid() { @Override public boolean equals(Object o) { - if (this == o) + if (this == o) { return true; - if (o == null || getClass() != o.getClass()) + } + if (o == null || getClass() != o.getClass()) { return false; + } FirstTypeDTO that = (FirstTypeDTO) o; return Objects.equals(uid, that.uid) && Objects.equals(description, that.description); } diff --git a/bundles/org.openhab.core.model.yaml/src/test/java/org/openhab/core/model/yaml/test/SecondTypeDTO.java b/bundles/org.openhab.core.model.yaml/src/test/java/org/openhab/core/model/yaml/test/SecondTypeDTO.java index 200980995e8..c4d94fdcd28 100644 --- a/bundles/org.openhab.core.model.yaml/src/test/java/org/openhab/core/model/yaml/test/SecondTypeDTO.java +++ b/bundles/org.openhab.core.model.yaml/src/test/java/org/openhab/core/model/yaml/test/SecondTypeDTO.java @@ -48,10 +48,12 @@ public boolean isValid() { @Override public boolean equals(Object o) { - if (this == o) + if (this == o) { return true; - if (o == null || getClass() != o.getClass()) + } + if (o == null || getClass() != o.getClass()) { return false; + } SecondTypeDTO that = (SecondTypeDTO) o; return Objects.equals(id, that.id) && Objects.equals(label, that.label); } diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/link/ItemChannelLinkRegistry.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/link/ItemChannelLinkRegistry.java index 12aed390c65..d872f9dc0dd 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/link/ItemChannelLinkRegistry.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/link/ItemChannelLinkRegistry.java @@ -12,7 +12,12 @@ */ package org.openhab.core.thing.link; -import java.util.*; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream;