Skip to content

Commit

Permalink
Reduce SAT warnings (openhab#3586)
Browse files Browse the repository at this point in the history
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
  • Loading branch information
holgerfriedrich authored May 1, 2023
1 parent a77a303 commit 5e0a4ff
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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<String, List<TagDTO>> tags = Map.of( //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
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;

Expand Down Expand Up @@ -63,11 +60,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);
Expand Down

0 comments on commit 5e0a4ff

Please sign in to comment.