Fix build and improve exception handling (#10726)

The PercentType and QuantityType can also throw an IllegalArgumentException.

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born
2021-05-20 19:15:23 +02:00
committed by GitHub
parent b049d3d13b
commit a032118213
7 changed files with 9 additions and 11 deletions

View File

@@ -92,7 +92,7 @@ public class DimmerItemConverter extends AbstractTransformingItemConverter {
value = PercentType.ZERO.toBigDecimal();
}
newState = new PercentType(value);
} catch (NumberFormatException e) {
} catch (IllegalArgumentException e) {
// ignore
}
}

View File

@@ -14,8 +14,6 @@ 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;
@@ -62,7 +60,7 @@ public class NumberItemConverter extends AbstractTransformingItemConverter {
return new QuantityType<>(trimmedValue);
}
}
} catch (IllegalArgumentException | MeasurementParseException e) {
} catch (IllegalArgumentException e) {
// finally failed
}
}