Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2014-02-22 06:32:03 -0500
committerUwe Stieber2014-02-22 06:33:09 -0500
commit922aca6844fffbce850e9394173f7f36b410f911 (patch)
treeb02119d11187bca1f248b147ee03204e1d53a1e2
parent3e48d55da1cfd6ef643645e5e2f8bfc0dfb75304 (diff)
downloadorg.eclipse.tcf-922aca6844fffbce850e9394173f7f36b410f911.tar.gz
org.eclipse.tcf-922aca6844fffbce850e9394173f7f36b410f911.tar.xz
org.eclipse.tcf-922aca6844fffbce850e9394173f7f36b410f911.zip
Target Explorer: Add possible connection timeout cause to the WaitForReadyStep error
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nls/Messages.java1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nls/Messages.properties1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/WaitForReadyStep.java11
3 files changed, 13 insertions, 0 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nls/Messages.java
index 4d27e892b..48c49aae5 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nls/Messages.java
@@ -68,4 +68,5 @@ public class Messages extends NLS {
// **** Declare externalized string id's down here *****
public static String WaitForReadyStep_error_timeout;
+ public static String WaitForReadyStep_error_timeout_cause;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nls/Messages.properties
index 6c2545049..d68436028 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nls/Messages.properties
@@ -11,3 +11,4 @@
WaitForReadyStep_error_timeout=Failed to connect to ''{0}''.\n\n\
The attempt to connect the connection timed out. Please check that the connection properties are \
valid. Verify also that no firewall is blocking the communication.
+WaitForReadyStep_error_timeout_cause=\n\nProbably caused by:\n{0}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/WaitForReadyStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/WaitForReadyStep.java
index 38a3f3e64..60734bbde 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/WaitForReadyStep.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/WaitForReadyStep.java
@@ -14,6 +14,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeoutException;
+import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -70,6 +71,8 @@ public class WaitForReadyStep extends AbstractPeerNodeStep {
int totalWork = getTotalWork(context, data);
SimulatorUtils.Result result = SimulatorUtils.getSimulatorService(getActivePeerModelContext(context, data, fullQualifiedId));
int refreshCount = result != null ? 0 : totalWork-1;
+ final AtomicReference<Throwable> lastError = new AtomicReference<Throwable>();
+
@Override
public void run() {
if (ProgressHelper.isCancel(WaitForReadyStep.this, monitor, callback)) {
@@ -78,6 +81,11 @@ public class WaitForReadyStep extends AbstractPeerNodeStep {
else if (refreshCount >= totalWork) {
@SuppressWarnings("synthetic-access")
String message = NLS.bind(Messages.WaitForReadyStep_error_timeout, getActivePeerContext(context, data, fullQualifiedId).getName());
+ if (lastError.get() != null) {
+ String cause = lastError.get().getLocalizedMessage();
+ if (cause == null || "".equals(cause.trim())) cause = lastError.get().getClass().getName(); //$NON-NLS-1$
+ message += NLS.bind(Messages.WaitForReadyStep_error_timeout_cause, cause);
+ }
callback(data, fullQualifiedId, callback, StatusHelper.getStatus(new TimeoutException(message)), null);
}
else {
@@ -123,6 +131,9 @@ public class WaitForReadyStep extends AbstractPeerNodeStep {
return;
}
+ // Remember the last error for use later
+ lastError.set(error);
+
// Try again until timed out
refreshCount++;
ProgressHelper.worked(monitor, 1);

Back to the top