1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

Merge "Bug 478843 - TelnetConnection should return default port and timeout"

This commit is contained in:
Greg Watson 2015-10-15 09:20:28 -04:00 committed by Gerrit Code Review @ Eclipse.org
commit d44fbc3417

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;
} }