Source:
public IRemoteConnection createConnection(IRemoteConnectionType connectionType, URI hostUri, String hostName) throws RemoteConnectionException { 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) { try { IRemoteConnectionWorkingCopy wc = null; wc = connectionType.newConnection(hostName); if (wc == null) { throw new RemoteConnectionException(MessageFormat.format(Messages.RemoteConnection_ConnectionError, hostUri)); } if (connectionType.getId().equals(JSchConnection.JSCH_ID)) { wc.setAttribute(JSchConnection.ADDRESS_ATTR, hostUri.getHost()); wc.setAttribute(JSchConnection.PORT_ATTR, Integer.toString(hostUri.getPort())); String user = hostUri.getUserInfo(); if (user == null) { user = System.getProperty("user.name"); } wc.setAttribute(JSchConnection.USERNAME_ATTR, user); wc.setAttribute(JSchConnection.TIMEOUT_ATTR, Integer.toString(0)); 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; }

Target:
public IRemoteConnection createConnection(IRemoteConnectionType connectionType, URI hostUri, String hostName) throws RemoteConnectionException { 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) { try { IRemoteConnectionWorkingCopy wc = null; wc = connectionType.newConnection(hostName); if (wc == null) { throw new RemoteConnectionException(MessageFormat.format(Messages.RemoteConnection_ConnectionError, hostUri)); } if (connectionType.getId().equals(JSchConnection.JSCH_ID)) { wc.setAttribute(JSchConnection.ADDRESS_ATTR, hostUri.getHost()); wc.setAttribute(JSchConnection.PORT_ATTR, Integer.toString(hostUri.getPort())); String user = hostUri.getUserInfo(); if (user == null) { user = System.getProperty("user.name"); } wc.setAttribute(JSchConnection.USERNAME_ATTR, user); wc.setAttribute(JSchConnection.IS_PASSWORD_ATTR, Boolean.TRUE.toString()); 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; }