diff --git a/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/BluetoothUnit.java b/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/BluetoothUnit.java index 411256e191848..ce21c6debd8c1 100644 --- a/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/BluetoothUnit.java +++ b/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/BluetoothUnit.java @@ -230,9 +230,6 @@ public static class BUnits { public static final Unit KILOGRAM_PER_SQUARE_METER = addUnit( new ProductUnit(SIUnits.KILOGRAM.divide(SIUnits.SQUARE_METRE))); - public static final Unit COULOMB_PER_KILOGRAM = addUnit( - new ProductUnit(Units.COULOMB.divide(SIUnits.KILOGRAM))); - public static final Unit GRAY_PER_SECOND = addUnit( new ProductUnit(Units.GRAY.divide(Units.SECOND))); diff --git a/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/CharacteristicChannelTypeProvider.java b/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/CharacteristicChannelTypeProvider.java index 52a80c50478df..4b523a14195b6 100644 --- a/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/CharacteristicChannelTypeProvider.java +++ b/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/CharacteristicChannelTypeProvider.java @@ -108,10 +108,7 @@ private static boolean isValidUID(ChannelTypeUID channelTypeUID) { if (channelID.charAt(30) != '-') { return false; } - if (channelID.charAt(67) != '-') { - return false; - } - return true; + return !(channelID.charAt(67) != '-'); } public ChannelTypeUID registerChannelType(String characteristicUUID, boolean advanced, boolean readOnly, @@ -135,7 +132,7 @@ private ChannelType buildChannelType(ChannelTypeUID channelTypeUID, boolean adva throw new IllegalStateException("Unknown field format type: " + field.getUnit()); } - if (itemType.equals("Switch")) { + if ("Switch".equals(itemType)) { options = Collections.emptyList(); } diff --git a/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/GenericBluetoothHandler.java b/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/GenericBluetoothHandler.java index 644e23bf898f8..c1f8a58484951 100644 --- a/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/GenericBluetoothHandler.java +++ b/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/GenericBluetoothHandler.java @@ -202,7 +202,7 @@ private void handleServiceData(BluetoothScanNotification scanNotification) { .hasPropertyEnabled(BluetoothCharacteristic.PROPERTY_BROADCAST)) .collect(Collectors.toUnmodifiableList()); - if (broadcastCharacteristics.size() == 0) { + if (broadcastCharacteristics.isEmpty()) { logger.info( "No Characteristic of service with UUID {} on {} has the broadcast property set, ignored.", uuidStr, scanNotification.getAddress()); @@ -298,7 +298,6 @@ private String getCharacteristicUUID() { } public void handleCommand(ChannelUID channelUID, Command command) { - // Handle REFRESH if (command == RefreshType.REFRESH) { if (canRead()) { diff --git a/bundles/org.openhab.binding.bluetooth.generic/src/test/java/org/openhab/binding/bluetooth/generic/internal/BluetoothUnitTest.java b/bundles/org.openhab.binding.bluetooth.generic/src/test/java/org/openhab/binding/bluetooth/generic/internal/BluetoothUnitTest.java index 3ef65307d54b0..bc90cb9bf9099 100644 --- a/bundles/org.openhab.binding.bluetooth.generic/src/test/java/org/openhab/binding/bluetooth/generic/internal/BluetoothUnitTest.java +++ b/bundles/org.openhab.binding.bluetooth.generic/src/test/java/org/openhab/binding/bluetooth/generic/internal/BluetoothUnitTest.java @@ -12,12 +12,14 @@ */ package org.openhab.binding.bluetooth.generic.internal; +import org.eclipse.jdt.annotation.NonNullByDefault; import org.junit.jupiter.api.Test; /** * @author Connor Petty - Initial contribution * */ +@NonNullByDefault class BluetoothUnitTest { @Test