mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-16 13:35:22 +02:00
Fix error message in case of canceled ssh transfer
This commit is contained in:
parent
992747ac6a
commit
ce3c3c4ca9
1 changed files with 31 additions and 24 deletions
|
@ -252,6 +252,10 @@ public class SftpFileService extends AbstractFileService implements IFileService
|
||||||
channel=(ChannelSftp)fSessionProvider.getSession().openChannel("sftp"); //$NON-NLS-1$
|
channel=(ChannelSftp)fSessionProvider.getSession().openChannel("sftp"); //$NON-NLS-1$
|
||||||
channel.connect();
|
channel.connect();
|
||||||
channel.put(localFile.getAbsolutePath(), dst, sftpMonitor, mode); //$NON-NLS-1$
|
channel.put(localFile.getAbsolutePath(), dst, sftpMonitor, mode); //$NON-NLS-1$
|
||||||
|
Activator.trace("SftpFileService.upload "+remoteFile+ " ok"); //$NON-NLS-1$ //$NON-NLS-1$
|
||||||
|
if (monitor.isCanceled()) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
SftpATTRS attr = channel.stat(dst);
|
SftpATTRS attr = channel.stat(dst);
|
||||||
attr.setACMODTIME(attr.getATime(), (int)(localFile.lastModified()/1000));
|
attr.setACMODTIME(attr.getATime(), (int)(localFile.lastModified()/1000));
|
||||||
////TODO check if we want to maintain permissions
|
////TODO check if we want to maintain permissions
|
||||||
|
@ -265,7 +269,7 @@ public class SftpFileService extends AbstractFileService implements IFileService
|
||||||
System.err.println("ssh.upload: file size mismatch for "+dst);
|
System.err.println("ssh.upload: file size mismatch for "+dst);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Activator.trace("SftpFileService.upload "+remoteFile+ " ok"); //$NON-NLS-1$ //$NON-NLS-1$
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
//TODO See download
|
//TODO See download
|
||||||
|
@ -350,6 +354,10 @@ public class SftpFileService extends AbstractFileService implements IFileService
|
||||||
channel=(ChannelSftp)fSessionProvider.getSession().openChannel("sftp"); //$NON-NLS-1$
|
channel=(ChannelSftp)fSessionProvider.getSession().openChannel("sftp"); //$NON-NLS-1$
|
||||||
channel.connect();
|
channel.connect();
|
||||||
channel.get(remotePath, localFile.getAbsolutePath(), sftpMonitor, mode); //$NON-NLS-1$
|
channel.get(remotePath, localFile.getAbsolutePath(), sftpMonitor, mode); //$NON-NLS-1$
|
||||||
|
Activator.trace("SftpFileService.download "+remoteFile+ " ok"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
if (monitor.isCanceled()) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
SftpATTRS attr = channel.stat(remotePath);
|
SftpATTRS attr = channel.stat(remotePath);
|
||||||
localFile.setLastModified(1000L * attr.getMTime());
|
localFile.setLastModified(1000L * attr.getMTime());
|
||||||
//TODO should we set the read-only status?
|
//TODO should we set the read-only status?
|
||||||
|
@ -360,8 +368,7 @@ public class SftpFileService extends AbstractFileService implements IFileService
|
||||||
System.err.println("ssh.download: file size mismatch for "+remotePath);
|
System.err.println("ssh.download: file size mismatch for "+remotePath);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Activator.trace("SftpFileService.download "+remoteFile+ " ok"); //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
//TODO handle exception properly: happens e.g. when trying to download a symlink.
|
//TODO handle exception properly: happens e.g. when trying to download a symlink.
|
||||||
|
|
Loading…
Add table
Reference in a new issue