зеркало из https://github.com/mozilla/smarthome.git
avoid IllegalArgumentException when storing complex objects (like BigDecimal) as a configuration
Signed-off-by: Kai Kreuzer <kai@openhab.org>
This commit is contained in:
Родитель
810a54b981
Коммит
a7a9db0d0d
|
@ -78,7 +78,13 @@ public class ConfigurationService {
|
|||
}
|
||||
}
|
||||
for (Entry<String, Object> configurationParameter : configurationParameters) {
|
||||
properties.put(configurationParameter.getKey(), configurationParameter.getValue());
|
||||
Object value = configurationParameter.getValue();
|
||||
if (value == null || value instanceof String || value instanceof Integer || value instanceof Boolean) {
|
||||
properties.put(configurationParameter.getKey(), value);
|
||||
} else {
|
||||
// the config admin does not support complex object types, so let's store the string representation
|
||||
properties.put(configurationParameter.getKey(), value.toString());
|
||||
}
|
||||
}
|
||||
configuration.update(properties);
|
||||
return oldConfiguration;
|
||||
|
|
Загрузка…
Ссылка в новой задаче