Also allow Double if the value is an integer number

JSON parses all integers to doubles, hence we have to deal with this situation as well.
It probably makes sense to merge all this validation logic with the ConfigValidation code soon.

Signed-off-by: Kai Kreuzer <kai@openhab.org>
This commit is contained in:
Kai Kreuzer 2016-04-14 17:37:17 +02:00
Родитель 1a7473c662
Коммит 0f2a554dc6
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -222,7 +222,8 @@ public class RuntimeRule extends Rule {
case BOOLEAN:
return configValue instanceof Boolean;
case INTEGER:
return configValue instanceof BigDecimal || configValue instanceof Integer;
return configValue instanceof BigDecimal || configValue instanceof Integer
|| configValue instanceof Double && ((Double) configValue).intValue() == (double) configValue;
case DECIMAL:
return configValue instanceof BigDecimal || configValue instanceof Double;
}