Source:
<code>public IRemoteConnection createConnection(URI hostUri, String hostName) throws RemoteConnectionException { IRemoteConnectionType connectionType = getConnectionType(hostUri); IRemoteConnection connection = null; for (IRemoteConnection conn : connectionType.getConnections()) { if (conn.getName().equals(hostName)) { IRemoteConnectionHostService hostService = conn.getService(IRemoteConnectionHostService.class); if (hostService != null) { if ((hostService.getHostname().equals(hostUri.getHost())) && (hostUri.getPort() == -1 || hostService.getPort() == hostUri.getPort())) { connection = conn; break; } throw new RemoteConnectionException(MessageFormat.format(Messages.RemoteConnection_DuplicateConnectionError, hostName, hostService.getHostname(), hostService.getPort())); } } } if (connection == null) { IRemoteConnectionWorkingCopy wc = null; wc = connectionType.newConnection(hostName); if (wc == null) { throw new RemoteConnectionException(MessageFormat.format(Messages.RemoteConnection_ConnectionError, hostUri)); } if (wc.hasService(IRemoteConnectionHostService.class)) { IRemoteConnectionHostService hostService = <START> <END> wc.getService(IRemoteConnectionHostService.class); hostService.setHostname(hostUri.getHost()); hostService.setPort(hostUri.getPort()); String user = hostUri.getUserInfo(); if (user == null) { user = System.getProperty("user.name"); } hostService.setUsername(user); } else { throw new RemoteConnectionException(MessageFormat.format(Messages.RemoteConnection_ConnectionError, hostUri)); } try { connection = wc.save(); } catch (RemoteConnectionException e) { throw new RemoteConnectionException(MessageFormat.format(Messages.RemoteConnection_ConnectionError, hostUri), e); } } if (connection == null) { throw new RemoteConnectionException(MessageFormat.format(Messages.RemoteConnection_ConnectionError, hostUri)); } return connection; }</code><technical_language>space</technical_language>

Target:
public IRemoteConnection createConnection(URI hostUri, String hostName) throws RemoteConnectionException { IRemoteConnectionType connectionType = getConnectionType(hostUri); IRemoteConnection connection = null; for (IRemoteConnection conn : connectionType.getConnections()) { if (conn.getName().equals(hostName)) { IRemoteConnectionHostService hostService = conn.getService(IRemoteConnectionHostService.class); if (hostService != null) { if ((hostService.getHostname().equals(hostUri.getHost())) && (hostUri.getPort() == -1 || hostService.getPort() == hostUri.getPort())) { connection = conn; break; } throw new RemoteConnectionException(MessageFormat.format(Messages.RemoteConnection_DuplicateConnectionError, hostName, hostService.getHostname(), hostService.getPort())); } } } if (connection == null) { IRemoteConnectionWorkingCopy wc = null; wc = connectionType.newConnection(hostName); if (wc == null) { throw new RemoteConnectionException(MessageFormat.format(Messages.RemoteConnection_ConnectionError, hostUri)); } if (wc.hasService(IRemoteConnectionHostService.class)) { IRemoteConnectionHostService hostService = wc.getService(IRemoteConnectionHostService.class); hostService.setHostname(hostUri.getHost()); hostService.setPort(hostUri.getPort()); String user = hostUri.getUserInfo(); if (user == null) { user = System.getProperty("user.name"); } hostService.setUsername(user); hostService.setUsePassword(true); } else { throw new RemoteConnectionException(MessageFormat.format(Messages.RemoteConnection_ConnectionError, hostUri)); } try { connection = wc.save(); } catch (RemoteConnectionException e) { throw new RemoteConnectionException(MessageFormat.format(Messages.RemoteConnection_ConnectionError, hostUri), e); } } if (connection == null) { throw new RemoteConnectionException(MessageFormat.format(Messages.RemoteConnection_ConnectionError, hostUri)); } return connection; }