diff --git a/rse/plugins/org.eclipse.rse.services.ssh/src/org/eclipse/rse/internal/services/ssh/files/SftpFileService.java b/rse/plugins/org.eclipse.rse.services.ssh/src/org/eclipse/rse/internal/services/ssh/files/SftpFileService.java index 523f867c021..f1402201b44 100644 --- a/rse/plugins/org.eclipse.rse.services.ssh/src/org/eclipse/rse/internal/services/ssh/files/SftpFileService.java +++ b/rse/plugins/org.eclipse.rse.services.ssh/src/org/eclipse/rse/internal/services/ssh/files/SftpFileService.java @@ -54,6 +54,7 @@ import org.eclipse.rse.services.clientserver.messages.SystemMessageException; import org.eclipse.rse.services.files.AbstractFileService; import org.eclipse.rse.services.files.IFileService; import org.eclipse.rse.services.files.IHostFile; +import org.eclipse.rse.services.files.RemoteFileCancelledException; import org.eclipse.rse.services.files.RemoteFileIOException; import org.eclipse.rse.services.files.RemoteFileSecurityException; @@ -248,7 +249,6 @@ public class SftpFileService extends AbstractFileService implements IFileService //getFile() must return a dummy even for non-existent files, //or the move() operation will fail. This is described in //the API docs. - //TODO when monitor is canceled, it is unclear whether we should return an empty file node or throw a canceled exception. SftpHostFile node = null; SftpATTRS attrs = null; if (fDirChannelMutex.waitForLock(monitor, fDirChannelTimeout)) { @@ -267,6 +267,8 @@ public class SftpFileService extends AbstractFileService implements IFileService } finally { fDirChannelMutex.release(); } + } else { + throw new RemoteFileCancelledException(); } if (node==null) { node = new SftpHostFile(remoteParent, fileName, false, false, false, 0, 0); diff --git a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/RemoteFileCancelledException.java b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/RemoteFileCancelledException.java index 35256f9f1ff..0c6a019bc74 100644 --- a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/RemoteFileCancelledException.java +++ b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/RemoteFileCancelledException.java @@ -22,11 +22,8 @@ import org.eclipse.rse.services.clientserver.messages.SystemMessage; import org.eclipse.rse.services.clientserver.messages.SystemMessageException; /** - * Exception thrown when attempting an operation and it fails for IO reasons, such as - * the file is read-only. - *

- * The original remote system's io message is always embedded and retrievable - * via getRemoteException(). + * Exception thrown when attempting a file operation and the user + * canceled it before it could be completed. */ public class RemoteFileCancelledException extends RemoteFileIOException {