Upgrade Units of Measurement dependencies (#10583)

* Fix code/tests for upgrade
* Resolve runbundles
* Update Checkstyle ruleset for changed packages

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born
2021-05-11 08:31:03 +02:00
committed by GitHub
parent 0fd9c4c1f8
commit c3a6aa5814
24 changed files with 178 additions and 91 deletions

View File

@@ -14,6 +14,8 @@ package org.openhab.binding.http.internal.converter;
import java.util.function.Consumer;
import javax.measure.format.MeasurementParseException;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.http.internal.config.HttpChannelConfig;
@@ -60,7 +62,7 @@ public class NumberItemConverter extends AbstractTransformingItemConverter {
return new QuantityType<>(trimmedValue);
}
}
} catch (IllegalArgumentException e) {
} catch (IllegalArgumentException | MeasurementParseException e) {
// finally failed
}
}

View File

@@ -66,7 +66,7 @@ public class ConverterTest {
Assertions.assertEquals(new QuantityType<>(500, Units.WATT), converter.toState("500"));
// no valid value
Assertions.assertEquals(UnDefType.UNDEF, converter.toState("100°C"));
Assertions.assertEquals(UnDefType.UNDEF, converter.toState("100foo"));
Assertions.assertEquals(UnDefType.UNDEF, converter.toState("foo"));
Assertions.assertEquals(UnDefType.UNDEF, converter.toState(""));
}