1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-29 11:55:40 +02:00

Bug 478843 - TelnetConnection should return default port and timeout

Make TelnetConnection#getPort() and getTimout()
 return default port telnet (23) and timeout (0)
 if it isn't set with host services.

Change-Id: I740cd6a10b1f34d7f1afb956578b97b7886f36cc
Signed-off-by: Wainer dos Santos Moschetta <wainersm@linux.vnet.ibm.com>
This commit is contained in:
Wainer dos Santos Moschetta 2015-10-01 14:40:31 -03:00
parent 58c1857c15
commit 987c5c4efb

View file

@ -84,7 +84,8 @@ public class TelnetConnection implements IRemoteConnectionControlService, IRemot
@Override @Override
public int getPort() { public int getPort() {
try { try {
return Integer.parseInt(remoteConnection.getAttribute(PORT_ATTR)); String portStr = remoteConnection.getAttribute(PORT_ATTR);
return !portStr.isEmpty() ? Integer.parseInt(portStr) : DEFAULT_PORT;
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
return -1; return -1;
} }
@ -93,7 +94,8 @@ public class TelnetConnection implements IRemoteConnectionControlService, IRemot
@Override @Override
public int getTimeout() { public int getTimeout() {
try { try {
return Integer.parseInt(remoteConnection.getAttribute(TIMEOUT_ATTR)); String timeoutStr = remoteConnection.getAttribute(TIMEOUT_ATTR);
return !timeoutStr.isEmpty() ? Integer.parseInt(timeoutStr) : DEFAULT_TIMEOUT;
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
return -1; return -1;
} }