List of usage examples for org.springframework.beans PropertyAccessException getMostSpecificCause
public Throwable getMostSpecificCause()
From source file:net.solarnetwork.node.power.modbus.ModbusPowerDatumDataSource.java
private void setRegisterAddressValue(final PropertyAccessor bean, final Integer addr, final String propertyName, final Integer propertyValue) { if (bean.isWritableProperty(propertyName)) { Number value = propertyValue; if (registerScaleFactor != null && registerScaleFactor.containsKey(addr)) { value = Double.valueOf(value.intValue() * registerScaleFactor.get(addr)); }// ww w . j av a2s . c om log.trace("Setting property {} for address 0x{} to [{}]", propertyName, Integer.toHexString(addr), value); try { bean.setPropertyValue(propertyName, value); } catch (PropertyAccessException e) { log.warn("Unable to set property {} to {} for address 0x{}: {}", propertyName, value, Integer.toHexString(addr), e.getMostSpecificCause().getMessage()); } } else { log.warn("Property {} not available; bad configuration", propertyName); } }