From d1ce821329717ba577cbd844bcd5108ed77738ab Mon Sep 17 00:00:00 2001
From: Uwe Stieber
Date: Mon, 14 Jul 2014 15:54:13 +0200
Subject: Target Explorer: Fix stepper based channel manager error handling
---
.../tcf/te/runtime/stepper/job/StepperJob.java | 4 ++
.../te/runtime/stepper/utils/StepperHelper.java | 8 +--
.../META-INF/MANIFEST.MF | 1 +
.../core/channelmanager/OpenChannelException.java | 70 ++++++++++++++++++++++
.../internal/channelmanager/ChannelManager2.java | 37 ++++++++----
.../channelmanager/steps/ApplyPathMapsStep.java | 15 ++---
.../channelmanager/steps/ChainPeerStep.java | 17 ++++--
.../channelmanager/steps/CloseChannelStep.java | 22 ++++---
.../channelmanager/steps/LaunchValueAddStep.java | 11 ++--
.../channelmanager/steps/ShutdownValueAddStep.java | 18 ++++--
.../tcf/te/tcf/locator/steps/WaitForReadyStep.java | 10 ++--
11 files changed, 156 insertions(+), 57 deletions(-)
create mode 100644 target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/channelmanager/OpenChannelException.java
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/job/StepperJob.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/job/StepperJob.java
index e6c3d16c9..d9dad274c 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/job/StepperJob.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/job/StepperJob.java
@@ -291,6 +291,10 @@ public final class StepperJob extends Job {
handler[0].handleStatus(status, null, null);
}
}
+ markStatusHandled();
+ }
+
+ public void markStatusHandled() {
statusHandled = true;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/utils/StepperHelper.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/utils/StepperHelper.java
index ab7dd8c2e..03582c986 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/utils/StepperHelper.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/utils/StepperHelper.java
@@ -39,12 +39,10 @@ public final class StepperHelper {
return stepperOperationService;
}
- public static final StepperJob scheduleStepperJob(Object context, String operation, IStepperOperationService service, IPropertiesContainer data, ICallback callback, IProgressMonitor monitor) {
+ public static final void scheduleStepperJob(Object context, String operation, IStepperOperationService service, IPropertiesContainer data, ICallback callback, IProgressMonitor monitor) {
Assert.isNotNull(service);
Assert.isNotNull(data);
- StepperJob job = null;
-
IStepContext stepContext = service.getStepContext(context, operation);
String stepGroupId = service.getStepGroupId(context, operation);
String name = service.getStepGroupName(context, operation);
@@ -59,7 +57,7 @@ public final class StepperHelper {
}
if (stepGroupId != null && stepContext != null) {
- job = new StepperJob(name != null ? name : "", stepContext, data, stepGroupId, operation, isCancelable, monitor == null); //$NON-NLS-1$
+ StepperJob job = new StepperJob(name != null ? name : "", stepContext, data, stepGroupId, operation, isCancelable, monitor == null); //$NON-NLS-1$
job.setJobCallback(callback);
if (monitor != null) {
@@ -69,7 +67,5 @@ public final class StepperHelper {
job.schedule();
}
}
-
- return job;
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/META-INF/MANIFEST.MF
index b916bd82b..d9663ff07 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/META-INF/MANIFEST.MF
@@ -21,6 +21,7 @@ Bundle-Localization: plugin
Export-Package: org.eclipse.tcf.te.tcf.core,
org.eclipse.tcf.te.tcf.core.activator;x-internal:=true,
org.eclipse.tcf.te.tcf.core.async,
+ org.eclipse.tcf.te.tcf.core.channelmanager,
org.eclipse.tcf.te.tcf.core.concurrent,
org.eclipse.tcf.te.tcf.core.help,
org.eclipse.tcf.te.tcf.core.interfaces,
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/channelmanager/OpenChannelException.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/channelmanager/OpenChannelException.java
new file mode 100644
index 000000000..c688fc142
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/channelmanager/OpenChannelException.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.core.channelmanager;
+
+import org.eclipse.core.runtime.Assert;
+
+/**
+ * Special exception thrown if peer.openChannel()
fails. The exception
+ * will wrap the original error but allows handlers to distinguish between errors happening
+ * while trying to open the channel and errors happening after the peer.openChannel()
,
+ * thrown by failing steps of the open channel step group.
+ */
+public class OpenChannelException extends Throwable {
+ private static final long serialVersionUID = 4715084774433865088L;
+ private final Throwable error;
+
+ /**
+ * Constructor.
+ *
+ * @param error The error. Must not be null
.
+ */
+ public OpenChannelException(Throwable error) {
+ super();
+ Assert.isNotNull(error);
+ this.error = error;
+ }
+
+ /**
+ * Returns the error.
+ *
+ * @return The error.
+ */
+ public Throwable getError() {
+ return error;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof OpenChannelException) {
+ return error.equals(((OpenChannelException)obj).error);
+ }
+ return super.equals(obj);
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return error.hashCode();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Throwable#toString()
+ */
+ @Override
+ public String toString() {
+ return error.toString();
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/ChannelManager2.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/ChannelManager2.java
index 698817904..a8d578cc3 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/ChannelManager2.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/ChannelManager2.java
@@ -30,6 +30,7 @@ import org.eclipse.tcf.te.runtime.callback.Callback;
import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepperOperationService;
import org.eclipse.tcf.te.runtime.stepper.job.StepperJob;
import org.eclipse.tcf.te.runtime.stepper.utils.StepperHelper;
@@ -248,12 +249,18 @@ public class ChannelManager2 extends PlatformObject implements IChannelManager {
IStepperOperationService stepperOperationService = StepperHelper.getService(peer, StepperOperationService.OPEN_CHANNEL);
// Schedule the "open channel" stepper job
- job = StepperHelper.scheduleStepperJob(peer,
- StepperOperationService.OPEN_CHANNEL,
- stepperOperationService,
- data,
- callback,
- null);
+ IStepContext stepContext = stepperOperationService.getStepContext(peer, StepperOperationService.OPEN_CHANNEL);
+ String stepGroupId = stepperOperationService.getStepGroupId(peer, StepperOperationService.OPEN_CHANNEL);
+
+ if (stepGroupId != null && stepContext != null) {
+ String name = stepperOperationService.getStepGroupName(peer, StepperOperationService.OPEN_CHANNEL);
+ boolean isCancelable = stepperOperationService.isCancelable(peer, StepperOperationService.OPEN_CHANNEL);
+
+ job = new StepperJob(name != null ? name : "", stepContext, data, stepGroupId, StepperOperationService.OPEN_CHANNEL, isCancelable, true); //$NON-NLS-1$
+ job.setJobCallback(callback);
+ job.markStatusHandled();
+ job.schedule();
+ }
// Remember the "open channel" stepper job until finished
if (job != null) {
@@ -419,12 +426,18 @@ public class ChannelManager2 extends PlatformObject implements IChannelManager {
IStepperOperationService stepperOperationService = StepperHelper.getService(peer, StepperOperationService.CLOSE_CHANNEL);
// Schedule the "close channel" stepper job
- job = StepperHelper.scheduleStepperJob(peer,
- StepperOperationService.CLOSE_CHANNEL,
- stepperOperationService,
- data,
- callback,
- null);
+ IStepContext stepContext = stepperOperationService.getStepContext(peer, StepperOperationService.CLOSE_CHANNEL);
+ String stepGroupId = stepperOperationService.getStepGroupId(peer, StepperOperationService.CLOSE_CHANNEL);
+
+ if (stepGroupId != null && stepContext != null) {
+ String name = stepperOperationService.getStepGroupName(peer, StepperOperationService.CLOSE_CHANNEL);
+ boolean isCancelable = stepperOperationService.isCancelable(peer, StepperOperationService.CLOSE_CHANNEL);
+
+ job = new StepperJob(name != null ? name : "", stepContext, data, stepGroupId, StepperOperationService.CLOSE_CHANNEL, isCancelable, true); //$NON-NLS-1$
+ job.setJobCallback(callback);
+ job.markStatusHandled();
+ job.schedule();
+ }
// Remember the "close channel" stepper job until finished
if (job != null) {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ApplyPathMapsStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ApplyPathMapsStep.java
index 672e2835d..dd753775e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ApplyPathMapsStep.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ApplyPathMapsStep.java
@@ -35,20 +35,19 @@ import org.eclipse.tcf.te.tcf.core.steps.AbstractPeerStep;
*/
public class ApplyPathMapsStep extends AbstractPeerStep {
- /**
- * Constructor.
- */
- public ApplyPathMapsStep() {
- }
-
/* (non-Javadoc)
* @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
public void validateExecute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ Assert.isNotNull(context);
+ Assert.isNotNull(data);
+ Assert.isNotNull(fullQualifiedId);
+ Assert.isNotNull(monitor);
+
IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_CHANNEL, fullQualifiedId, data);
if (channel == null || channel.getState() != IChannel.STATE_OPEN) {
- throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "Channel to target not available.")); //$NON-NLS-1$
+ throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "Channel to target not available or closed.")); //$NON-NLS-1$
}
}
@@ -64,7 +63,9 @@ public class ApplyPathMapsStep extends AbstractPeerStep {
Assert.isNotNull(callback);
final IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_CHANNEL, fullQualifiedId, data);
+ Assert.isNotNull(channel);
final IPeer peer = getActivePeerContext(context, data, fullQualifiedId);
+ Assert.isNotNull(peer);
Runnable runnable = new Runnable() {
@Override
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ChainPeerStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ChainPeerStep.java
index 6ac19ef1b..331cb04a9 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ChainPeerStep.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ChainPeerStep.java
@@ -26,6 +26,7 @@ import org.eclipse.tcf.te.runtime.stepper.StepperAttributeUtil;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
import org.eclipse.tcf.te.runtime.utils.StatusHelper;
+import org.eclipse.tcf.te.tcf.core.channelmanager.OpenChannelException;
import org.eclipse.tcf.te.tcf.core.interfaces.steps.ITcfStepAttributes;
import org.eclipse.tcf.te.tcf.core.steps.AbstractPeerStep;
@@ -34,12 +35,6 @@ import org.eclipse.tcf.te.tcf.core.steps.AbstractPeerStep;
*/
public class ChainPeerStep extends AbstractPeerStep {
- /**
- * Constructor.
- */
- public ChainPeerStep() {
- }
-
/* (non-Javadoc)
* @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
*/
@@ -66,6 +61,11 @@ public class ChainPeerStep extends AbstractPeerStep {
public void run() {
IChannel c = channel.get();
+ // Flag to remember if openChannel or redirect is triggering
+ // the channel listener invocation. Repackage the error if
+ // the channel listener is invoked because of calling openChannel.
+ final boolean openChannelCalled = c == null;
+
// If the channel is not yet opened, open it now.
// Otherwise redirect the channel to the next peer.
if (c == null) {
@@ -92,6 +92,11 @@ public class ChainPeerStep extends AbstractPeerStep {
public void onChannelClosed(Throwable error) {
// Remove ourself as listener from the channel
channel.get().removeChannelListener(this);
+ // If invoked as result to an openChannel call, the error is repackaged
+ if (openChannelCalled && error != null) {
+ error = new OpenChannelException(error);
+ }
+ // Invoke the callback
callback(data, fullQualifiedId, callback, StatusHelper.getStatus(error), null);
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/CloseChannelStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/CloseChannelStep.java
index cc645a8de..d688256e6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/CloseChannelStep.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/CloseChannelStep.java
@@ -12,6 +12,7 @@ package org.eclipse.tcf.te.tcf.core.internal.channelmanager.steps;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.tcf.protocol.IChannel;
import org.eclipse.tcf.protocol.Protocol;
@@ -20,6 +21,7 @@ import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.stepper.StepperAttributeUtil;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.tcf.core.activator.CoreBundleActivator;
import org.eclipse.tcf.te.tcf.core.interfaces.steps.ITcfStepAttributes;
import org.eclipse.tcf.te.tcf.core.steps.AbstractPeerStep;
@@ -28,17 +30,20 @@ import org.eclipse.tcf.te.tcf.core.steps.AbstractPeerStep;
*/
public class CloseChannelStep extends AbstractPeerStep {
- /**
- * Constructor.
- */
- public CloseChannelStep() {
- }
-
/* (non-Javadoc)
* @see org.eclipse.tcf.te.runtime.stepper.interfaces.IExtendedStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
public void validateExecute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ Assert.isNotNull(context);
+ Assert.isNotNull(data);
+ Assert.isNotNull(fullQualifiedId);
+ Assert.isNotNull(monitor);
+
+ IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_CHANNEL, fullQualifiedId, data);
+ if (channel == null) {
+ throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "Channel to target not available.")); //$NON-NLS-1$
+ }
}
/* (non-Javadoc)
@@ -53,13 +58,12 @@ public class CloseChannelStep extends AbstractPeerStep {
Assert.isNotNull(callback);
final IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_CHANNEL, fullQualifiedId, data);
+ Assert.isNotNull(channel);
Runnable runnable = new Runnable() {
@Override
public void run() {
- if (channel != null && channel.getState() != IChannel.STATE_CLOSED) {
- channel.close();
- }
+ if (channel.getState() != IChannel.STATE_CLOSED) channel.close();
callback(data, fullQualifiedId, callback, Status.OK_STATUS, null);
}
};
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/LaunchValueAddStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/LaunchValueAddStep.java
index bb3d432ac..d562889e2 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/LaunchValueAddStep.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/LaunchValueAddStep.java
@@ -32,17 +32,16 @@ import org.eclipse.tcf.te.tcf.core.va.interfaces.IValueAdd;
*/
public class LaunchValueAddStep extends AbstractPeerStep {
- /**
- * Constructor.
- */
- public LaunchValueAddStep() {
- }
-
/* (non-Javadoc)
* @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
public void validateExecute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ Assert.isNotNull(context);
+ Assert.isNotNull(data);
+ Assert.isNotNull(fullQualifiedId);
+ Assert.isNotNull(monitor);
+
IValueAdd valueAdd = (IValueAdd)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_VALUE_ADD, fullQualifiedId, data);
if (valueAdd == null) {
throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "Value-add descriptor instance not set.")); //$NON-NLS-1$
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ShutdownValueAddStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ShutdownValueAddStep.java
index c52b6aa2a..533433952 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ShutdownValueAddStep.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ShutdownValueAddStep.java
@@ -10,6 +10,7 @@
package org.eclipse.tcf.te.tcf.core.internal.channelmanager.steps;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -30,17 +31,16 @@ import org.eclipse.tcf.te.tcf.core.va.interfaces.IValueAdd;
*/
public class ShutdownValueAddStep extends AbstractPeerStep {
- /**
- * Constructor.
- */
- public ShutdownValueAddStep() {
- }
-
/* (non-Javadoc)
* @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
public void validateExecute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ Assert.isNotNull(context);
+ Assert.isNotNull(data);
+ Assert.isNotNull(fullQualifiedId);
+ Assert.isNotNull(monitor);
+
IValueAdd valueAdd = (IValueAdd)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_VALUE_ADD, fullQualifiedId, data);
if (valueAdd == null) {
throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "Value-add descriptor instance not set.")); //$NON-NLS-1$
@@ -52,6 +52,12 @@ public class ShutdownValueAddStep extends AbstractPeerStep {
*/
@Override
public void execute(final IStepContext context, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, final IProgressMonitor monitor, final ICallback callback) {
+ Assert.isNotNull(context);
+ Assert.isNotNull(data);
+ Assert.isNotNull(fullQualifiedId);
+ Assert.isNotNull(monitor);
+ Assert.isNotNull(callback);
+
final IValueAdd valueAdd = (IValueAdd)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_VALUE_ADD, fullQualifiedId, data);
final String peerId = getActivePeerContext(context, data, fullQualifiedId).getID();
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 cf31d292c..2e3792a6d 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
@@ -33,9 +33,9 @@ import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
import org.eclipse.tcf.te.runtime.utils.ProgressHelper;
import org.eclipse.tcf.te.runtime.utils.StatusHelper;
import org.eclipse.tcf.te.tcf.core.Tcf;
+import org.eclipse.tcf.te.tcf.core.channelmanager.OpenChannelException;
import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager;
import org.eclipse.tcf.te.tcf.core.interfaces.steps.ITcfStepAttributes;
-import org.eclipse.tcf.te.tcf.core.va.ValueAddException;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelUpdateService;
import org.eclipse.tcf.te.tcf.locator.nls.Messages;
@@ -151,14 +151,14 @@ public class WaitForReadyStep extends AbstractPeerNodeStep {
return;
}
- // Value add exceptions are reported to the user and breaks the wait immediately
- if (error instanceof ValueAddException) {
- callback(data, fullQualifiedId, callback, StatusHelper.getStatus(((ValueAddException) error).getError()), null);
+ // ANY exceptions, except for OpenChannelExceptions, are reported to the user and breaks the wait immediately
+ if (error != null && !(error instanceof OpenChannelException)) {
+ callback(data, fullQualifiedId, callback, StatusHelper.getStatus(error), null);
return;
}
// Remember the last error for use later
- lastError.set(error);
+ lastError.set(error instanceof OpenChannelException ? ((OpenChannelException) error).getError() : error);
// Try again until timed out
refreshCount++;
--
cgit v1.2.3