1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-14 04:25:21 +02:00

[225089][ssh][shells][api] Canceling connection leads to exception

https://bugs.eclipse.org/bugs/show_bug.cgi?id=225089
This commit is contained in:
David Dykstal 2008-04-04 13:34:06 +00:00
parent 8612a3d254
commit bb8d4a18c5
10 changed files with 78 additions and 48 deletions

View file

@ -28,6 +28,7 @@
* David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
* David McKnight (IBM) - [220123] [api][dstore] Configurable timeout on irresponsiveness * David McKnight (IBM) - [220123] [api][dstore] Configurable timeout on irresponsiveness
* David McKnight (IBM) - [223204] [cleanup] fix broken nls strings in files.ui and others * David McKnight (IBM) - [223204] [cleanup] fix broken nls strings in files.ui and others
* David Dykstal (IBM) - [225089][ssh][shells][api] Canceling connection leads to exception
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.connectorservice.dstore; package org.eclipse.rse.connectorservice.dstore;
@ -44,6 +45,7 @@ import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.dstore.core.client.ClientConnection; import org.eclipse.dstore.core.client.ClientConnection;
import org.eclipse.dstore.core.client.ConnectionStatus; import org.eclipse.dstore.core.client.ConnectionStatus;
import org.eclipse.dstore.core.java.IRemoteClassInstance; import org.eclipse.dstore.core.java.IRemoteClassInstance;
@ -1070,7 +1072,7 @@ public class DStoreConnectorService extends StandardConnectorService implements
{ {
acquireCredentials(true); acquireCredentials(true);
} }
catch (InterruptedException e) catch (OperationCanceledException e)
{ {
connectException = e; connectException = e;
} }
@ -1078,7 +1080,7 @@ public class DStoreConnectorService extends StandardConnectorService implements
}); });
// Check if the user cancelled the prompt // Check if the user cancelled the prompt
if (connectException instanceof InterruptedException) if (connectException instanceof OperationCanceledException)
{ {
throw connectException; throw connectException;
} }
@ -1215,7 +1217,7 @@ public class DStoreConnectorService extends StandardConnectorService implements
{ {
acquireCredentials(true); acquireCredentials(true);
} }
catch (InterruptedException e) catch (OperationCanceledException e)
{ {
connectException = e; connectException = e;
} }
@ -1223,7 +1225,7 @@ public class DStoreConnectorService extends StandardConnectorService implements
}); });
// Check if the user cancelled the prompt // Check if the user cancelled the prompt
if (connectException instanceof InterruptedException) if (connectException instanceof OperationCanceledException)
{ {
throw connectException; throw connectException;
} }

View file

@ -13,10 +13,12 @@
* David Dykstal (IBM) - 142806: refactoring persistence framework * David Dykstal (IBM) - 142806: refactoring persistence framework
* Martin Oberhuber (Wind River) - [185750] Remove IConnectorService.getHostType() * Martin Oberhuber (Wind River) - [185750] Remove IConnectorService.getHostType()
* David Dykstal (IBM) - [210474] Deny save password function missing * David Dykstal (IBM) - [210474] Deny save password function missing
* David Dykstal (IBM) - [225089][ssh][shells][api] Canceling connection leads to exception
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.core.subsystems; package org.eclipse.rse.core.subsystems;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.IPropertySet; import org.eclipse.rse.core.model.IPropertySet;
import org.eclipse.rse.core.model.IRSEPersistableContainer; import org.eclipse.rse.core.model.IRSEPersistableContainer;
@ -446,7 +448,7 @@ public abstract class AbstractDelegatingConnectorService implements IDelegatingC
* @see org.eclipse.rse.core.subsystems.IConnectorService#acquireCredentials(boolean) * @see org.eclipse.rse.core.subsystems.IConnectorService#acquireCredentials(boolean)
*/ */
public void acquireCredentials(boolean forcePrompt) public void acquireCredentials(boolean forcePrompt)
throws InterruptedException { throws OperationCanceledException {
IConnectorService conServ = getRealConnectorService(); IConnectorService conServ = getRealConnectorService();
if (conServ != null) if (conServ != null)
{ {

View file

@ -10,12 +10,14 @@
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
* Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
* David Dykstal (IBM) - [210474] Deny save password function missing * David Dykstal (IBM) - [210474] Deny save password function missing
* David Dykstal (IBM) - [225089][ssh][shells][api] Canceling connection leads to exception
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.core.subsystems; package org.eclipse.rse.core.subsystems;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.IRSESystemType;
import org.eclipse.rse.core.IRSEUserIdConstants; import org.eclipse.rse.core.IRSEUserIdConstants;
import org.eclipse.rse.core.PasswordPersistenceManager; import org.eclipse.rse.core.PasswordPersistenceManager;
@ -185,7 +187,7 @@ public abstract class AuthenticatingConnectorService extends AbstractConnectorSe
* @param reacquire if true will cause the credentials to be reobtained if necessary. * @param reacquire if true will cause the credentials to be reobtained if necessary.
* @see org.eclipse.rse.core.subsystems.IConnectorService#acquireCredentials(boolean) * @see org.eclipse.rse.core.subsystems.IConnectorService#acquireCredentials(boolean)
*/ */
public final void acquireCredentials(boolean reacquire) throws InterruptedException { public final void acquireCredentials(boolean reacquire) throws OperationCanceledException {
credentialsProvider.acquireCredentials(reacquire); credentialsProvider.acquireCredentials(reacquire);
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2002, 2007 IBM Corporation. All rights reserved. * Copyright (c) 2002, 2008 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
@ -12,9 +12,11 @@
* *
* Contributors: * Contributors:
* David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies * David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
* David Dykstal (IBM) - [225089][ssh][shells][api] Canceling connection leads to exception
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.core.subsystems; package org.eclipse.rse.core.subsystems;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.IHost;
/** /**
@ -85,7 +87,7 @@ public abstract class BasicConnectorService extends AbstractConnectorService {
* This implmentation does nothing. * This implmentation does nothing.
* @see org.eclipse.rse.core.subsystems.IConnectorService#acquireCredentials(boolean) * @see org.eclipse.rse.core.subsystems.IConnectorService#acquireCredentials(boolean)
*/ */
public void acquireCredentials(boolean refresh) throws InterruptedException { public void acquireCredentials(boolean refresh) throws OperationCanceledException {
} }
/** /**

View file

@ -17,11 +17,13 @@
* Martin Oberhuber (Wind River) - [187218] Fix error reporting for connect() * Martin Oberhuber (Wind River) - [187218] Fix error reporting for connect()
* Martin Oberhuber (Wind River) - [cleanup] Add API "since" Javadoc tags * Martin Oberhuber (Wind River) - [cleanup] Add API "since" Javadoc tags
* David Dykstal (IBM) - [210474] Deny save password function missing * David Dykstal (IBM) - [210474] Deny save password function missing
* David Dykstal (IBM) - [225089][ssh][shells][api] Canceling connection leads to exception
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.core.subsystems; package org.eclipse.rse.core.subsystems;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.IRSEModelObject; import org.eclipse.rse.core.model.IRSEModelObject;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException; import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
@ -87,7 +89,8 @@ public interface IConnectorService extends IRSEModelObject {
* @param monitor a monitor for tracking the progress and canceling a connect * @param monitor a monitor for tracking the progress and canceling a connect
* operation. * operation.
* @throws Exception an exception of there is a failure to connect. * @throws Exception an exception of there is a failure to connect.
* Typically, this will be a {@link SystemMessageException}. * Typically, this will be a {@link SystemMessageException}.
* If the connect was canceled by the user this will be an {@link OperationCanceledException}
*/ */
public void connect(IProgressMonitor monitor) throws Exception; public void connect(IProgressMonitor monitor) throws Exception;
@ -127,7 +130,7 @@ public interface IConnectorService extends IRSEModelObject {
/** /**
* Sets the host used by this connector service. * Sets the host used by this connector service.
* @param host * @param host the host to be used for this connector service
*/ */
public void setHost(IHost host); public void setHost(IHost host);
@ -274,12 +277,12 @@ public interface IConnectorService extends IRSEModelObject {
* Implementations may retain a remembered credentials or * Implementations may retain a remembered credentials or
* use this acquire the credentials using some implementation defined means. * use this acquire the credentials using some implementation defined means.
* <p> * <p>
* Throws InterruptedException if acquisition of the * Throws {@link OperationCanceledException} if acquisition of the
* credentials is canceled or is being suppressed. * credentials is canceled or is being suppressed.
* @param refresh if true will force the connector service to discard * @param refresh if true will force the connector service to discard
* any remembered value and reacquire the credentials. * any remembered value and reacquire the credentials.
*/ */
public void acquireCredentials(boolean refresh) throws InterruptedException; public void acquireCredentials(boolean refresh) throws OperationCanceledException;
/** /**
* @return true if the acquisition of credentials is being suppressed. * @return true if the acquisition of credentials is being suppressed.
@ -391,8 +394,7 @@ public interface IConnectorService extends IRSEModelObject {
* If set to true, it will clear any saved passwords for this system and not allow any further * If set to true, it will clear any saved passwords for this system and not allow any further
* passwords to be stored. * passwords to be stored.
* This property of a system is persistent from session to session, but is not sharable. * This property of a system is persistent from session to session, but is not sharable.
* @param deny * @param deny If true, forget any saved passwords and do not allow any others to be saved.
* If true, forget any saved passwords and do not allow any others to be saved.
* If false, allow passwords to be saved in the keychain. * If false, allow passwords to be saved in the keychain.
* @return the number of saved passwords removed by this operation. * @return the number of saved passwords removed by this operation.
* This will always be zero if "deny" is false. * This will always be zero if "deny" is false.

View file

@ -1,14 +1,16 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2007 IBM Corporation. All rights reserved. * Copyright (c) 2007, 2008 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
* *
* Initial Contributors: * Initial Contributors:
* David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies * David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
* David Dykstal (IBM) - [225089][ssh][shells][api] Canceling connection leads to exception
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.core.subsystems; package org.eclipse.rse.core.subsystems;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.rse.services.clientserver.messages.SystemMessage; import org.eclipse.rse.services.clientserver.messages.SystemMessage;
/** /**
@ -37,12 +39,12 @@ public interface ICredentialsProvider {
* @param reacquire true if the provider should refresh any remembered * @param reacquire true if the provider should refresh any remembered
* credentials. Typically used to force the showing of a dialog containing * credentials. Typically used to force the showing of a dialog containing
* remembered credentials. * remembered credentials.
* @throws InterruptedException if the acquisition of credentials is * @throws OperationCanceledException if the acquisition of credentials is
* canceled by the user, if the provider is in suppressed state, * canceled by the user, if the provider is in suppressed state,
* a resource (such as the workbench) not being available, * a resource (such as the workbench) not being available,
* or interrupted by some other means. * or interrupted by some other means.
*/ */
void acquireCredentials(boolean reacquire) throws InterruptedException; void acquireCredentials(boolean reacquire) throws OperationCanceledException;
/** /**
* The connector service using this provider may find the credentials provided * The connector service using this provider may find the credentials provided
@ -51,11 +53,11 @@ public interface ICredentialsProvider {
* an expired password. * an expired password.
* @param message the message indicating the nature of the damage that must * @param message the message indicating the nature of the damage that must
* be repaired. For example, indicating expiration of a password. * be repaired. For example, indicating expiration of a password.
* @throws InterruptedException if the repair is canceled for some reason. This could * @throws OperationCanceledException if the repair is canceled for some reason. This could
* include the inability of a credentials provider to open a dialog or a dialog being * include the inability of a credentials provider to open a dialog or a dialog being
* canceled. * canceled.
*/ */
void repairCredentials(SystemMessage message)throws InterruptedException; void repairCredentials(SystemMessage message)throws OperationCanceledException;
/** /**
* Clears the credentials known by this credentials provider. This will * Clears the credentials known by this credentials provider. This will

View file

@ -18,11 +18,13 @@
* David McKnight (IBM) - [186363] get rid of obsolete calls to ISubSystem.connect() * David McKnight (IBM) - [186363] get rid of obsolete calls to ISubSystem.connect()
* David Dykstal (IBM) - [217556] remove service subsystem types * David Dykstal (IBM) - [217556] remove service subsystem types
* Martin Oberhuber (Wind River) - [cleanup] Add API "since" Javadoc tags * Martin Oberhuber (Wind River) - [cleanup] Add API "since" Javadoc tags
* David Dykstal (IBM) - [225089][ssh][shells][api] Canceling connection leads to exception
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.core.subsystems; package org.eclipse.rse.core.subsystems;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.jobs.ISchedulingRule; import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.rse.core.filters.ISystemFilter; import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager; import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
@ -390,9 +392,10 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* *
* @param monitor the progress monitor. Must not be <code>null</code>. * @param monitor the progress monitor. Must not be <code>null</code>.
* @param forcePrompt forces the prompt dialog to be displayed * @param forcePrompt forces the prompt dialog to be displayed
* even if the password is currently in memory. * even if the password is currently in memory.
* @throws Exception an exception if there is a failure to connect. * @throws Exception an exception if there is a failure to connect.
* Typically, this will be a {@link SystemMessageException}. * Typically, this will be a {@link SystemMessageException}.
* An {@link OperationCanceledException} will be thrown if the user cancels the connect.
*/ */
public void connect(IProgressMonitor monitor, boolean forcePrompt) throws Exception; public void connect(IProgressMonitor monitor, boolean forcePrompt) throws Exception;
@ -413,7 +416,8 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* @param callback to call after connect is complete. * @param callback to call after connect is complete.
* May be <code>null</code>. * May be <code>null</code>.
* @throws Exception an exception if there is a failure to connect. * @throws Exception an exception if there is a failure to connect.
* Typically, this will be a {@link SystemMessageException}. * Typically, this will be a {@link SystemMessageException}.
* An {@link OperationCanceledException} will be thrown if the user cancels the connect.
*/ */
public void connect(boolean forcePrompt, IRSECallback callback) throws Exception; public void connect(boolean forcePrompt, IRSECallback callback) throws Exception;

View file

@ -19,6 +19,7 @@
* David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
* David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
* David McKnight (IBM) - [223204] [cleanup] fix broken nls strings in files.ui and others * David McKnight (IBM) - [223204] [cleanup] fix broken nls strings in files.ui and others
* David Dykstal (IBM) - [225089][ssh][shells][api] Canceling connection leads to exception
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.files.ui.widgets; package org.eclipse.rse.files.ui.widgets;
@ -26,6 +27,7 @@ import java.util.Hashtable;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.osgi.util.NLS; import org.eclipse.osgi.util.NLS;
import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.IRSESystemType;
import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.RSECorePlugin;
@ -620,7 +622,7 @@ public class SystemQualifiedRemoteFolderCombo extends Composite
} else { } else {
ss.connect(false, null); ss.connect(false, null);
} }
} catch (InterruptedException exc) } catch (OperationCanceledException exc)
{ {
String msgTxt = NLS.bind(CommonMessages.MSG_CONNECT_CANCELED, conn.getHostName()); String msgTxt = NLS.bind(CommonMessages.MSG_CONNECT_CANCELED, conn.getHostName());
throw new Exception(msgTxt); throw new Exception(msgTxt);

View file

@ -34,6 +34,7 @@
* David Dykstal (IBM) - [217556] remove service subsystem types * David Dykstal (IBM) - [217556] remove service subsystem types
* David McKnight (IBM) - [220309] [nls] Some GenericMessages and SubSystemResources should move from UI to Core * David McKnight (IBM) - [220309] [nls] Some GenericMessages and SubSystemResources should move from UI to Core
* David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
* David Dykstal (IBM) - [225089][ssh][shells][api] Canceling connection leads to exception
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.core.subsystems; package org.eclipse.rse.core.subsystems;
@ -51,6 +52,7 @@ import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.ISchedulingRule; import org.eclipse.core.runtime.jobs.ISchedulingRule;
@ -527,7 +529,7 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
throw (SystemMessageException) e; throw (SystemMessageException) e;
} }
else else
if (e instanceof InterruptedException) if (e instanceof OperationCanceledException)
{ {
String msgTxt = NLS.bind(CommonMessages.MSG_CONNECT_CANCELED, getHost().getAliasName()); String msgTxt = NLS.bind(CommonMessages.MSG_CONNECT_CANCELED, getHost().getAliasName());
SystemMessage msg = new SimpleSystemMessage(RSECorePlugin.PLUGIN_ID, SystemMessage msg = new SimpleSystemMessage(RSECorePlugin.PLUGIN_ID,
@ -1334,6 +1336,11 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
monitor.done(); monitor.done();
return Status.OK_STATUS; return Status.OK_STATUS;
} }
catch(OperationCanceledException exc)
{
monitor.done();
return Status.CANCEL_STATUS;
}
catch(java.lang.InterruptedException exc) catch(java.lang.InterruptedException exc)
{ {
monitor.done(); monitor.done();
@ -1711,7 +1718,7 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
} }
} }
protected boolean implicitConnect(boolean isConnectOperation, IProgressMonitor mon, String msg, int totalWorkUnits) throws SystemMessageException, InvocationTargetException, InterruptedException protected boolean implicitConnect(boolean isConnectOperation, IProgressMonitor mon, String msg, int totalWorkUnits) throws SystemMessageException, InvocationTargetException, OperationCanceledException
{ {
boolean didConnection = false; boolean didConnection = false;
if ( doConnection && !isConnected())// caller wants to do connection first as part operation if ( doConnection && !isConnected())// caller wants to do connection first as part operation
@ -2311,17 +2318,20 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
} }
}); });
try { try {
if (exception[0]!=null) Exception e = exception[0];
throw exception[0]; if (e == null) {
getConnectorService().connect(monitor); getConnectorService().connect(monitor);
if (isConnected()) { if (isConnected()) {
final SubSystem ss = this; final SubSystem ss = this;
//Notify connect status change //Notify connect status change
Display.getDefault().asyncExec(new Runnable() { Display.getDefault().asyncExec(new Runnable() {
public void run() { public void run() {
RSECorePlugin.getTheSystemRegistry().connectedStatusChange(ss, true, false); RSECorePlugin.getTheSystemRegistry().connectedStatusChange(ss, true, false);
} }
}); });
}
} else {
throw e;
} }
} finally { } finally {
monitor.done(); monitor.done();
@ -2414,7 +2424,7 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
doConnection = true; doConnection = true;
ok = true; ok = true;
} }
catch (InterruptedException exc) // user cancelled catch (OperationCanceledException exc) // user cancelled
{ {
throw exc; throw exc;
} }
@ -2562,7 +2572,7 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
* <p> * <p>
* Your connect method in your IConnectorService class must follow these IRunnableWithProgress rules: * Your connect method in your IConnectorService class must follow these IRunnableWithProgress rules:
* <ul> * <ul>
* <li>if the user cancels (monitor.isCanceled()), throw new InterruptedException() * <li>if the user cancels (monitor.isCanceled()), throw new OperationCanceledException()
* <li>if something else bad happens, throw new java.lang.reflect.InvocationTargetException(exc) * <li>if something else bad happens, throw new java.lang.reflect.InvocationTargetException(exc)
* - well, actually you can throw anything and we'll wrap it here in an InvocationTargetException * - well, actually you can throw anything and we'll wrap it here in an InvocationTargetException
* <li>do not worry about calling monitor.done() ... caller will do that. * <li>do not worry about calling monitor.done() ... caller will do that.
@ -2570,7 +2580,7 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
* *
*/ */
private void internalConnect(IProgressMonitor monitor) private void internalConnect(IProgressMonitor monitor)
throws InvocationTargetException, InterruptedException throws InvocationTargetException, OperationCanceledException
{ {
try try
{ {
@ -2579,7 +2589,7 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
catch(InvocationTargetException exc) { catch(InvocationTargetException exc) {
throw exc; throw exc;
} }
catch (InterruptedException exc) { catch (OperationCanceledException exc) {
throw exc; throw exc;
} }
catch (Exception exc) { catch (Exception exc) {

View file

@ -10,9 +10,11 @@
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
* Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
* David Dykstal (IBM) - [210474] Deny save password function missing * David Dykstal (IBM) - [210474] Deny save password function missing
* David Dykstal (IBM) - [225089][ssh][shells][api] Canceling connection leads to exception
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui.subsystems; package org.eclipse.rse.ui.subsystems;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.IRSESystemType;
import org.eclipse.rse.core.PasswordPersistenceManager; import org.eclipse.rse.core.PasswordPersistenceManager;
@ -168,12 +170,12 @@ public class StandardCredentialsProvider extends AbstractCredentialsProvider {
* </ol> * </ol>
* @param reacquire if true then present the prompt even * @param reacquire if true then present the prompt even
* if the password was found and is valid. * if the password was found and is valid.
* @throws InterruptedException if user is prompted and user * @throws OperationCanceledException if user is prompted and user
* cancels that prompt or if {@link #isSuppressed()} is true. * cancels that prompt or if {@link #isSuppressed()} is true.
*/ */
public final void acquireCredentials(boolean reacquire) throws InterruptedException { public final void acquireCredentials(boolean reacquire) throws OperationCanceledException {
if (isSuppressed()) { if (isSuppressed()) {
throw new InterruptedException(); throw new OperationCanceledException();
} }
ISubSystem subsystem = getPrimarySubSystem(); ISubSystem subsystem = getPrimarySubSystem();
IHost host = subsystem.getHost(); IHost host = subsystem.getHost();
@ -276,7 +278,7 @@ public class StandardCredentialsProvider extends AbstractCredentialsProvider {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.ICredentialsProvider#repairCredentials(org.eclipse.rse.services.clientserver.messages.SystemMessage) * @see org.eclipse.rse.core.subsystems.ICredentialsProvider#repairCredentials(org.eclipse.rse.services.clientserver.messages.SystemMessage)
*/ */
public final void repairCredentials(SystemMessage prompt) throws InterruptedException { public final void repairCredentials(SystemMessage prompt) throws OperationCanceledException {
promptForNewPassword(prompt); promptForNewPassword(prompt);
} }
@ -383,19 +385,19 @@ public class StandardCredentialsProvider extends AbstractCredentialsProvider {
log.logError("Unexpected exception", t); //$NON-NLS-1$ log.logError("Unexpected exception", t); //$NON-NLS-1$
} }
private void promptForCredentials() throws InterruptedException { private void promptForCredentials() throws OperationCanceledException {
PromptForCredentials runnable = new PromptForCredentials(); PromptForCredentials runnable = new PromptForCredentials();
Display.getDefault().syncExec(runnable); Display.getDefault().syncExec(runnable);
if (runnable.isCanceled()) { if (runnable.isCanceled()) {
throw new InterruptedException(); throw new OperationCanceledException();
} }
} }
private void promptForNewPassword(SystemMessage prompt) throws InterruptedException { private void promptForNewPassword(SystemMessage prompt) throws OperationCanceledException {
PromptForNewPassword runnable = new PromptForNewPassword(prompt); PromptForNewPassword runnable = new PromptForNewPassword(prompt);
Display.getDefault().syncExec(runnable); Display.getDefault().syncExec(runnable);
if (runnable.isCancelled()) { if (runnable.isCancelled()) {
throw new InterruptedException(); throw new OperationCanceledException();
} }
} }