Source:
public void updated(Dictionary<String, ?> config) throws ConfigurationException { logger.trace("update() method is called!"); if (config != null) { String refreshIntervalString = (String) config.get("refresh"); if (StringUtils.isNotBlank(refreshIntervalString)) { refreshInterval = Long.parseLong(refreshIntervalString); } String newPort = (String) config.get("port"); String newHostName = (String) config.get("hostName"); if (StringUtils.isNotBlank(newPort) && StringUtils.isNotBlank(newHostName)) { logger.error( "both properties port and hostname configured, only one can be set according communication type serial (port) or IP (hostname)"); setProperlyConfigured(false); } else { if (StringUtils.isNotBlank(newPort)) { typeIsSerial = true; port = newPort; readResponseWaitTime = defaultSerialReadResponseWaitTime; } if (StringUtils.isNotBlank(newHostName)) { typeIsSerial = false; hostName = newHostName; readResponseWaitTime = defaultIpReadResponseWaitTime; } String readResponseWaitTimeString = (String) config.get("readResponseWaitTime"); if (StringUtils.isNotBlank(readResponseWaitTimeString)) { try { readResponseWaitTime = Long.parseLong(readResponseWaitTimeString); } catch (NumberFormatException e) { logger.warn("ignoring property 'readResponseWaitTime', not numeric"); } } if (typeIsSerial) { logger.info("ProperlyConfigured on port " + port + " with readResponseWaitTime on " + readResponseWaitTime); } else { logger.info("ProperlyConfigured with hostName " + hostName + " with readResponseWaitTime on " + readResponseWaitTime); } setProperlyConfigured(true); } } }

Target:
public void updated(Dictionary<String, ?> config) throws ConfigurationException { logger.trace("update() method is called!"); if (config != null) { String refreshIntervalString = (String) config.get("refresh"); if (StringUtils.isNotBlank(refreshIntervalString)) { refreshInterval = Long.parseLong(refreshIntervalString); } String newPort = (String) config.get("port"); String newHostName = (String) config.get("hostName"); if (StringUtils.isBlank(newPort) && StringUtils.isBlank(newHostName)) { logger.error("neither port neither hostname configured, no communication possible"); setProperlyConfigured(false); } else { if (StringUtils.isNotBlank(newPort) && StringUtils.isNotBlank(newHostName)) { logger.warn( "both properties port and hostname configured, only one should be set according communication type serial (port) or IP (hostname)"); } if (StringUtils.isNotBlank(newPort)) { typeIsSerial = true; port = newPort; readResponseWaitTime = defaultSerialReadResponseWaitTime; } else if (StringUtils.isNotBlank(newHostName)) { typeIsSerial = false; hostName = newHostName; readResponseWaitTime = defaultIpReadResponseWaitTime; } else { } String readResponseWaitTimeString = (String) config.get("readResponseWaitTime"); if (StringUtils.isNotBlank(readResponseWaitTimeString)) { try { readResponseWaitTime = Long.parseLong(readResponseWaitTimeString); } catch (NumberFormatException e) { logger.warn("ignoring property 'readResponseWaitTime', not numeric"); } } if (typeIsSerial) { logger.info("ProperlyConfigured on port with readResponseWaitTime on ", port, readResponseWaitTime); } else { logger.info("ProperlyConfigured with hostName with readResponseWaitTime on ", hostName, readResponseWaitTime); } setProperlyConfigured(true); } } }