mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-14 20:45:22 +02:00
Throw RemoteFileCanceledException in case IFileService#getFile() was canceled
This commit is contained in:
parent
17795ab579
commit
027ca1461a
2 changed files with 5 additions and 6 deletions
|
@ -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.AbstractFileService;
|
||||||
import org.eclipse.rse.services.files.IFileService;
|
import org.eclipse.rse.services.files.IFileService;
|
||||||
import org.eclipse.rse.services.files.IHostFile;
|
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.RemoteFileIOException;
|
||||||
import org.eclipse.rse.services.files.RemoteFileSecurityException;
|
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,
|
//getFile() must return a dummy even for non-existent files,
|
||||||
//or the move() operation will fail. This is described in
|
//or the move() operation will fail. This is described in
|
||||||
//the API docs.
|
//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;
|
SftpHostFile node = null;
|
||||||
SftpATTRS attrs = null;
|
SftpATTRS attrs = null;
|
||||||
if (fDirChannelMutex.waitForLock(monitor, fDirChannelTimeout)) {
|
if (fDirChannelMutex.waitForLock(monitor, fDirChannelTimeout)) {
|
||||||
|
@ -267,6 +267,8 @@ public class SftpFileService extends AbstractFileService implements IFileService
|
||||||
} finally {
|
} finally {
|
||||||
fDirChannelMutex.release();
|
fDirChannelMutex.release();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new RemoteFileCancelledException();
|
||||||
}
|
}
|
||||||
if (node==null) {
|
if (node==null) {
|
||||||
node = new SftpHostFile(remoteParent, fileName, false, false, false, 0, 0);
|
node = new SftpHostFile(remoteParent, fileName, false, false, false, 0, 0);
|
||||||
|
|
|
@ -22,11 +22,8 @@ import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exception thrown when attempting an operation and it fails for IO reasons, such as
|
* Exception thrown when attempting a file operation and the user
|
||||||
* the file is read-only.
|
* canceled it before it could be completed.
|
||||||
* <p>
|
|
||||||
* The original remote system's io message is always embedded and retrievable
|
|
||||||
* via getRemoteException().
|
|
||||||
*/
|
*/
|
||||||
public class RemoteFileCancelledException extends RemoteFileIOException {
|
public class RemoteFileCancelledException extends RemoteFileIOException {
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue