public boolean updateHostname(String newHostname) { boolean doUpdate = false; if (newHostname != null && m_hostname != null) { if (!newHostname.equals(m_hostname)) { doUpdate = true; } } else if (newHostname == null && m_hostname == null) { // do nothing } else { // one is null the other isn't, do the update doUpdate = true; } if (doUpdate) { setHostname(newHostname); return true; } else { return false; } }