Return a copy of data
authordadubrow
Tue, 28 Jul 2009 15:06:01 -0500
changeset 380 2c1483a2585f
parent 379 654d13a9d418
child 381 9a15cc2691b5
Return a copy of data
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	Tue Jul 28 14:30:52 2009 -0500
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java	Tue Jul 28 15:06:01 2009 -0500
@@ -297,14 +297,14 @@
 	}
 
 	public Collection<IConnectionType> getConnectionTypes() {
-		return connectionTypeIdMap.values();
+		return new ArrayList<IConnectionType>(connectionTypeIdMap.values());
 	}
 	
 	public Collection<IService> getCompatibleServices(IConnectionType connectionType) {
 		Check.checkContract(connectionTypeToServices != null);
 		Collection<IService> services = connectionTypeToServices.get(connectionType);
 		if (services != null)
-			return services;
+			return new ArrayList<IService>(services);
 		return Collections.EMPTY_LIST;
 	}
 	
@@ -403,11 +403,11 @@
 	 * @see com.nokia.carbide.remoteconnections.registry.IConnectionStore#getConnections()
 	 */
 	public Collection<IConnection> getConnections() {
-		return connectionToConnectedServices.keySet();
+		return new ArrayList<IConnection>(connectionToConnectedServices.keySet());
 	}
 	
 	public Collection<IConnectedService> getConnectedServices(IConnection connection) {
-		return connectionToConnectedServices.get(connection);
+		return new ArrayList<IConnectedService>(connectionToConnectedServices.get(connection));
 	}
 
 	private File getConnectionStorageFile() {
@@ -439,7 +439,7 @@
 	}
 	
 	public Collection<IService> getServices() {
-		return services;
+		return new ArrayList<IService>(services);
 	}
 
 	public IService findServiceByID(String id) {