1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-13 20:15:22 +02:00

[190904] Changing read-only attribute throws exception

This commit is contained in:
Martin Oberhuber 2008-05-26 21:33:12 +00:00
parent 95aa8638fb
commit 00814b79ad

View file

@ -27,6 +27,7 @@
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable * Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable
* Martin Oberhuber (Wind River) - [170910] Adopt RSE ITerminalService API for SSH * Martin Oberhuber (Wind River) - [170910] Adopt RSE ITerminalService API for SSH
* Radoslav Gerganov (ProSyst) - [230919] IFileService.delete() should not return a boolean * Radoslav Gerganov (ProSyst) - [230919] IFileService.delete() should not return a boolean
* Martin Oberhuber (Wind River) - [190904] Changing read-only attribute throws exception
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.services.ssh.files; package org.eclipse.rse.internal.services.ssh.files;
@ -909,7 +910,7 @@ public class SftpFileService extends AbstractFileService implements ISshService,
//simply try to delete --> if it really doesnt exist, this will throw an exception //simply try to delete --> if it really doesnt exist, this will throw an exception
//FIXME either throw SystemElementNotFoundException here OR add check for //FIXME either throw SystemElementNotFoundException here OR add check for
//SSH_FX_NO_SUCH_FILE in makeSystemMessageException() and throw SENFE there //SSH_FX_NO_SUCH_FILE in makeSystemMessageException() and throw SENFE there
getChannel("SftpFileService.delete.rm").rm(fullPathRecoded); //$NON-NLS-1$ getChannel("SftpFileService.delete.rm").rm(fullPathRecoded); //$NON-NLS-1$
} else { } else {
throw e; throw e;
} }
@ -1132,15 +1133,16 @@ public class SftpFileService extends AbstractFileService implements ISshService,
permNew |= 128; //u+w permNew |= 128; //u+w
} }
if (permNew != permOld) { if (permNew != permOld) {
//getChannel("SftpFileService.setReadOnly").chmod(permNew, path); //$NON-NLS-1$ getChannel("SftpFileService.setReadOnly").chmod(permNew, recode(path)); //$NON-NLS-1$
attr.setPERMISSIONS(permNew);
getChannel("SftpFileService.setReadOnly").setStat(recode(path), attr); //$NON-NLS-1$ ok=true;
Activator.trace("SftpFileService.setReadOnly ok"); //$NON-NLS-1$ Activator.trace("SftpFileService.setReadOnly ok"); //$NON-NLS-1$
} else { } else {
Activator.trace("SftpFileService.setReadOnly nothing-to-do"); //$NON-NLS-1$ Activator.trace("SftpFileService.setReadOnly nothing-to-do"); //$NON-NLS-1$
} }
} catch (Exception e) { } catch (Exception e) {
Activator.trace("SftpFileService.setReadOnly "+path+" failed: "+e.toString()); //$NON-NLS-1$ //$NON-NLS-2$ Activator.trace("SftpFileService.setReadOnly "+path+" failed: "+e.toString()); //$NON-NLS-1$ //$NON-NLS-2$
if ((e instanceof SftpException) && ((SftpException) e).id == ChannelSftp.SSH_FX_NO_SUCH_FILE) {
throw new SystemElementNotFoundException(Activator.PLUGIN_ID, path, "setReadOnly");
}
throw makeSystemMessageException(e); throw makeSystemMessageException(e);
} finally { } finally {
fDirChannelMutex.release(); fDirChannelMutex.release();