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:
@@ -92,7 +92,7 @@ public class DimmerItemConverter extends AbstractTransformingItemConverter {
|
||||
value = PercentType.ZERO.toBigDecimal();
|
||||
}
|
||||
newState = new PercentType(value);
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (IllegalArgumentException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user