From ffecddf429016a2ee41d62382d3385640061bd7e Mon Sep 17 00:00:00 2001 From: Holger Friedrich Date: Sun, 30 Apr 2023 21:06:33 +0200 Subject: [PATCH] Reduce SAT warnings Signed-off-by: Holger Friedrich --- .../io/rest/core/internal/profile/ProfileTypeResource.java | 2 -- .../openhab/core/io/rest/core/internal/tag/TagResource.java | 5 ----- .../org/openhab/core/io/rest/sse/internal/util/SseUtil.java | 1 - .../core/persistence/extensions/PersistenceExtensions.java | 2 -- .../org/openhab/core/thing/internal/AutoUpdateManager.java | 1 - .../org/openhab/core/internal/events/OSGiEventPublisher.java | 1 - .../org/openhab/core/internal/service/WatchServiceImpl.java | 1 - .../java/org/openhab/core/library/types/HSBTypeTest.java | 5 ----- 8 files changed, 18 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 408c600ae18..3e202346890 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 @@ private boolean profileTypeMatchesItemType(ProfileType pt, String itemType) { private boolean triggerProfileMatchesProfileType(ProfileType profileType, ChannelType channelType) { if (profileType instanceof TriggerProfileType triggerProfileType) { - if (triggerProfileType.getSupportedChannelTypeUIDs().isEmpty()) { return true; } @@ -167,7 +166,6 @@ private boolean triggerProfileMatchesProfileType(ProfileType profileType, Channe 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 ef0b6f95d66..be55ca2d26c 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.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 TagResource(final @Reference LocaleService localeService) { @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 bbe05c7c59c..9dd6af379aa 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 static EventDTO buildDTO(final Event event) { * @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 9bd3801e736..4b2bd7d7386 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 @@ @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 ec9cb4912a5..e7abeef6198 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 void receiveCommand(ItemCommandEvent commandEvent, Item item) { 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 d3cb35dc164..aebbabbe9a0 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 @@ private void postAsOSGiEvent(final EventAdmin eventAdmin, final Event event) thr 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 d3faf761fc6..a90de4c0eb7 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 void onEvent(@Nullable DirectoryChangeEvent directoryChangeEvent) throws 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 43ce328e0ae..6a4c6352039 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 @@ -63,11 +63,6 @@ public void testHsbToRgbConversion() { 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);