Commit 84ca59ee authored by Robert Smith's avatar Robert Smith
Browse files

Fixing RemoteAction bug

Moving a bugfix for #295

 from the 2.2.2 branch to 2.2.1.
Signed-off-by: Robert Smith's avatarRobert Smith <smithrw@ornl.gov>
parent 7f3c549e
package org.eclipse.ice.item.action; package org.eclipse.ice.item.action;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.List; import java.util.List;
import org.eclipse.remote.core.IRemoteConnection; import org.eclipse.remote.core.IRemoteConnection;
import org.eclipse.remote.core.IRemoteConnectionHostService;
import org.eclipse.remote.core.IRemoteConnectionType; import org.eclipse.remote.core.IRemoteConnectionType;
import org.eclipse.remote.core.IRemoteServicesManager; import org.eclipse.remote.core.IRemoteServicesManager;
import org.eclipse.remote.core.exception.RemoteConnectionException; import org.eclipse.remote.core.exception.RemoteConnectionException;
...@@ -82,27 +79,18 @@ public abstract class RemoteAction extends Action { ...@@ -82,27 +79,18 @@ public abstract class RemoteAction extends Action {
} }
if (connectionType != null) { if (connectionType != null) {
try {
// Loop over existing connections to see if the user already // Loop over existing connections to see if the user already
// specified // specified
// a connection to the provided host // a connection to the provided host
for (IRemoteConnection c : connectionType for (IRemoteConnection c : connectionType.getConnections()) {
.getConnections()) { if (host.equals(c.getName())) {
String connectionHost = c
.getService(IRemoteConnectionHostService.class)
.getHostname();
if (InetAddress.getByName(host).getHostAddress()
.equals(InetAddress.getByName(connectionHost)
.getHostAddress())) {
connection = c; connection = c;
// Found it, return the connection // Found it, return the connection
return connection; return connection;
} }
} }
} catch (UnknownHostException e) {
logger.error(getClass().getName() + " Exception!", e);
}
// If no connection found, let's ask the user to define it. // If no connection found, let's ask the user to define it.
if (connection == null) { if (connection == null) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment