# HG changeset patch # User John Dean # Date 1266440386 28800 # Node ID 77bc8173ce83eba7384f4ab5b447c5334289c8c3 # Parent 2856f9bc4ddffd606b58b5a96b7fc935c47b17c3 Fixes bug 10733. In Registry.getConnectedServices(IConnection), return empty collection instead of null. Use isEmpty() instead of == null for caller conditionals diff -r 2856f9bc4ddf -r 77bc8173ce83 connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java Wed Feb 17 12:59:07 2010 -0800 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java Wed Feb 17 12:59:46 2010 -0800 @@ -433,7 +433,7 @@ if (connectedServices != null) return new ArrayList(connectedServices); - return null; + return Collections.emptyList(); } private File getConnectionStorageFile() { diff -r 2856f9bc4ddf -r 77bc8173ce83 connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/ConnectionUIUtils.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/ConnectionUIUtils.java Wed Feb 17 12:59:07 2010 -0800 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/ConnectionUIUtils.java Wed Feb 17 12:59:46 2010 -0800 @@ -144,7 +144,7 @@ Collection connectedServices = Registry.instance().getConnectedServices(connection); // if any service is in-use, then connection is in-use - if (connectedServices == null) + if (connectedServices.isEmpty()) return null; for (IConnectedService connectedService : connectedServices) { diff -r 2856f9bc4ddf -r 77bc8173ce83 connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/SettingsWizard.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/SettingsWizard.java Wed Feb 17 12:59:07 2010 -0800 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/SettingsWizard.java Wed Feb 17 12:59:46 2010 -0800 @@ -139,7 +139,7 @@ private void saveConnectedServicesEnabledState() { Collection connectedServices = Registry.instance().getConnectedServices(connectionToEdit); - if (connectedServices == null) + if (connectedServices.isEmpty()) return; if (savedEnabledStates == null) savedEnabledStates = new HashMap(); @@ -150,7 +150,7 @@ private void enableConnectedServices(boolean enabled) { Collection connectedServices = Registry.instance().getConnectedServices(connectionToEdit); - if (connectedServices == null || savedEnabledStates == null) + if (connectedServices.isEmpty() || savedEnabledStates == null) return; for (IConnectedService connectedService : connectedServices) { if (!enabled) // disable when asked diff -r 2856f9bc4ddf -r 77bc8173ce83 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceDialog.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceDialog.java Wed Feb 17 12:59:07 2010 -0800 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceDialog.java Wed Feb 17 12:59:46 2010 -0800 @@ -196,11 +196,9 @@ if (connection != null) { IConnectedService connectedService = null; Collection services = manager.getConnectedServices(connection); - if (services != null) { - for (IConnectedService service : services) { - if (service != null && service.getService().getIdentifier().equals(data.getService().getIdentifier())) { - connectedService = service; - } + for (IConnectedService service : services) { + if (service != null && service.getService().getIdentifier().equals(data.getService().getIdentifier())) { + connectedService = service; } }