From 5e0a4ff25acadf0eceb0509dd8eae46218882264 Mon Sep 17 00:00:00 2001 From: Holger Friedrich Date: Mon, 1 May 2023 09:08:26 +0200 Subject: [PATCH] Reduce SAT warnings (#3586) Signed-off-by: Holger Friedrich --- .../rest/core/internal/profile/ProfileTypeResource.java | 2 -- .../core/io/rest/core/internal/tag/TagResource.java | 5 ----- .../openhab/core/io/rest/sse/internal/util/SseUtil.java | 1 - .../persistence/extensions/PersistenceExtensions.java | 2 -- .../openhab/core/thing/internal/AutoUpdateManager.java | 1 - .../openhab/core/internal/events/OSGiEventPublisher.java | 1 - .../openhab/core/internal/service/WatchServiceImpl.java | 1 - .../java/org/openhab/core/library/types/HSBTypeTest.java | 8 -------- 8 files changed, 21 deletions(-) diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/profile/ProfileTypeResource.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/profile/ProfileTypeResource.java index 408c600ae1..3e20234689 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/profile/ProfileTypeResource.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/profile/ProfileTypeResource.java @@ -153,7 +153,6 @@ public class ProfileTypeResource implements RESTResource { private boolean triggerProfileMatchesProfileType(ProfileType profileType, ChannelType channelType) { if (profileType instanceof TriggerProfileType triggerProfileType) { - if (triggerProfileType.getSupportedChannelTypeUIDs().isEmpty()) { return true; } @@ -167,7 +166,6 @@ public class ProfileTypeResource implements RESTResource { private boolean stateProfileMatchesProfileType(ProfileType profileType, ChannelType channelType) { if (profileType instanceof StateProfileType stateProfileType) { - if (stateProfileType.getSupportedItemTypesOfChannel().isEmpty()) { return true; } diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/tag/TagResource.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/tag/TagResource.java index ef0b6f95d6..be55ca2d26 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/tag/TagResource.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/tag/TagResource.java @@ -47,8 +47,6 @@ import org.osgi.service.jaxrs.whiteboard.propertytypes.JSONRequired; import org.osgi.service.jaxrs.whiteboard.propertytypes.JaxrsApplicationSelect; import org.osgi.service.jaxrs.whiteboard.propertytypes.JaxrsName; import org.osgi.service.jaxrs.whiteboard.propertytypes.JaxrsResource; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -75,8 +73,6 @@ public class TagResource implements RESTResource { /** The URI path to this resource */ public static final String PATH_TAGS = "tags"; - private final Logger logger = LoggerFactory.getLogger(TagResource.class); - private final LocaleService localeService; @Activate @@ -91,7 +87,6 @@ public class TagResource implements RESTResource { @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = TagDTO.class)))) }) public Response getTags(final @Context UriInfo uriInfo, final @Context HttpHeaders httpHeaders, @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language) { - final Locale locale = localeService.getLocale(language); Map> tags = Map.of( // diff --git a/bundles/org.openhab.core.io.rest.sse/src/main/java/org/openhab/core/io/rest/sse/internal/util/SseUtil.java b/bundles/org.openhab.core.io.rest.sse/src/main/java/org/openhab/core/io/rest/sse/internal/util/SseUtil.java index bbe05c7c59..9dd6af379a 100644 --- a/bundles/org.openhab.core.io.rest.sse/src/main/java/org/openhab/core/io/rest/sse/internal/util/SseUtil.java +++ b/bundles/org.openhab.core.io.rest.sse/src/main/java/org/openhab/core/io/rest/sse/internal/util/SseUtil.java @@ -51,7 +51,6 @@ public class SseUtil { * @return a new OutboundEvent */ public static OutboundSseEvent buildEvent(OutboundSseEvent.Builder eventBuilder, EventDTO event) { - return eventBuilder.name("message") // .mediaType(MediaType.APPLICATION_JSON_TYPE) // .data(event) // diff --git a/bundles/org.openhab.core.persistence/src/main/java/org/openhab/core/persistence/extensions/PersistenceExtensions.java b/bundles/org.openhab.core.persistence/src/main/java/org/openhab/core/persistence/extensions/PersistenceExtensions.java index 9bd3801e73..4b2bd7d738 100644 --- a/bundles/org.openhab.core.persistence/src/main/java/org/openhab/core/persistence/extensions/PersistenceExtensions.java +++ b/bundles/org.openhab.core.persistence/src/main/java/org/openhab/core/persistence/extensions/PersistenceExtensions.java @@ -52,8 +52,6 @@ import org.slf4j.LoggerFactory; @Component(immediate = true) public class PersistenceExtensions { - private static final BigDecimal BIG_DECIMAL_TWO = BigDecimal.valueOf(2); - private static PersistenceServiceRegistry registry; @Activate diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/AutoUpdateManager.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/AutoUpdateManager.java index ec9cb4912a..e7abeef619 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/AutoUpdateManager.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/AutoUpdateManager.java @@ -142,7 +142,6 @@ public class AutoUpdateManager { final String itemName = commandEvent.getItemName(); final Command command = commandEvent.getItemCommand(); if (command instanceof State state) { - Recommendation autoUpdate = shouldAutoUpdate(item); // consider user-override via item meta-data diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/events/OSGiEventPublisher.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/events/OSGiEventPublisher.java index d3cb35dc16..aebbabbe9a 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/events/OSGiEventPublisher.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/events/OSGiEventPublisher.java @@ -60,7 +60,6 @@ public class OSGiEventPublisher implements EventPublisher { properties.put("source", source); } eventAdmin.postEvent(new org.osgi.service.event.Event("openhab", properties)); - } catch (Exception e) { throw new IllegalStateException("Cannot post the event via the event bus. Error message: " + e.getMessage(), e); diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/service/WatchServiceImpl.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/service/WatchServiceImpl.java index d3faf761fc..a90de4c0eb 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/service/WatchServiceImpl.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/service/WatchServiceImpl.java @@ -231,7 +231,6 @@ public class WatchServiceImpl implements WatchService, DirectoryChangeListener { future = scheduler.schedule(() -> notifyListeners(path), PROCESSING_TIME, TimeUnit.MILLISECONDS); scheduledEventKinds.computeIfAbsent(path, k -> new CopyOnWriteArrayList<>()).add(directoryChangeEvent); scheduledEvents.put(path, future); - } } diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/types/HSBTypeTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/types/HSBTypeTest.java index 43ce328e0a..b10dbf4f24 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/types/HSBTypeTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/types/HSBTypeTest.java @@ -16,9 +16,6 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.*; -import java.math.BigDecimal; -import java.math.RoundingMode; - import org.eclipse.jdt.annotation.NonNullByDefault; import org.junit.jupiter.api.Test; @@ -63,11 +60,6 @@ public class HSBTypeTest { compareHsbToRgbValues("300,100,40", 102, 0, 102); } - private int convertPercentToByte(PercentType percent) { - return percent.value.multiply(BigDecimal.valueOf(255)).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP) - .intValue(); - } - private void compareHsbToRgbValues(String hsbValues, int red, int green, int blue) { HSBType hsb = new HSBType(hsbValues); HSBType hsbRgb = HSBType.fromRGB(red, green, blue);