### Eclipse Workspace Patch 1.0 #P org.eclipse.rse.subsystems.wince Index: src/org/eclipse/rse/internal/services/wince/files/WinCEFileService.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.core/wince/org.eclipse.rse.subsystems.wince/src/org/eclipse/rse/internal/services/wince/files/WinCEFileService.java,v retrieving revision 1.12 diff -u -r1.12 WinCEFileService.java --- src/org/eclipse/rse/internal/services/wince/files/WinCEFileService.java 13 May 2008 11:45:15 -0000 1.12 +++ src/org/eclipse/rse/internal/services/wince/files/WinCEFileService.java 23 May 2008 08:46:18 -0000 @@ -13,6 +13,7 @@ * Radoslav Gerganov (ProSyst) - [230850] [WinCE] Implement setLastModified and setReadOnly in WinCEFileService * Radoslav Gerganov (ProSyst) - [231425] [WinCE] Use the progress monitors in WinCEFileService * Radoslav Gerganov (ProSyst) - [230856] [WinCE] Improve the error handling in WinCEFileService + * Radoslav Gerganov (ProSyst) - [230919] IFileService.delete() should not return a boolean *******************************************************************************/ package org.eclipse.rse.internal.services.wince.files; @@ -36,6 +37,7 @@ import org.eclipse.rse.services.clientserver.FileTypeMatcher; import org.eclipse.rse.services.clientserver.IMatcher; import org.eclipse.rse.services.clientserver.NamePatternMatcher; +import org.eclipse.rse.services.clientserver.messages.SystemElementNotFoundException; import org.eclipse.rse.services.clientserver.messages.SystemMessageException; import org.eclipse.rse.services.clientserver.messages.SystemOperationCancelledException; import org.eclipse.rse.services.clientserver.messages.SystemUnexpectedErrorException; @@ -196,13 +198,16 @@ } } - public boolean delete(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException { + public void delete(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException { String fullPath = concat(remoteParent, fileName); IRapiSession session = sessionProvider.getSession(); if (monitor == null) { monitor = new NullProgressMonitor(); } try { + if (!exist(session, fullPath)) { + throw new SystemElementNotFoundException(fullPath, "delete"); //$NON-NLS-1$ + } if (isDirectory(session, fullPath)) { // recursive delete if it is a directory RapiFindData[] allFiles = session.findAllFiles(concat(fullPath, "*"), Rapi.FAF_NAME); //$NON-NLS-1$ @@ -221,7 +226,6 @@ } catch (RapiException e) { throw new RemoteFileIOException(e); } - return true; } public void download(String remoteParent, String remoteFile, File localFile, boolean isBinary, String hostEncoding, #P org.eclipse.rse.services.ssh Index: src/org/eclipse/rse/internal/services/ssh/files/SftpFileService.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.ssh/src/org/eclipse/rse/internal/services/ssh/files/SftpFileService.java,v retrieving revision 1.51 diff -u -r1.51 SftpFileService.java --- src/org/eclipse/rse/internal/services/ssh/files/SftpFileService.java 7 May 2008 04:48:41 -0000 1.51 +++ src/org/eclipse/rse/internal/services/ssh/files/SftpFileService.java 23 May 2008 08:46:20 -0000 @@ -26,6 +26,7 @@ * Martin Oberhuber (Wind River) - [224799] Fix JSch encoding problems with Arabic filenames * Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable * Martin Oberhuber (Wind River) - [170910] Adopt RSE ITerminalService API for SSH + * Radoslav Gerganov (ProSyst) - [230919] IFileService.delete() should not return a boolean *******************************************************************************/ package org.eclipse.rse.internal.services.ssh.files; @@ -68,6 +69,7 @@ import org.eclipse.rse.services.clientserver.IMatcher; import org.eclipse.rse.services.clientserver.NamePatternMatcher; import org.eclipse.rse.services.clientserver.PathUtility; +import org.eclipse.rse.services.clientserver.messages.SystemElementNotFoundException; import org.eclipse.rse.services.clientserver.messages.SystemLockTimeoutException; import org.eclipse.rse.services.clientserver.messages.SystemMessage; import org.eclipse.rse.services.clientserver.messages.SystemMessageException; @@ -891,7 +893,7 @@ return result; } - public boolean delete(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException + public void delete(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException { String fullPath = concat(remoteParent, fileName); Activator.trace("SftpFileService.delete.waitForLock"); //$NON-NLS-1$ @@ -905,14 +907,16 @@ //bug 154419: test for dangling symbolic link if (e.id == ChannelSftp.SSH_FX_NO_SUCH_FILE) { //simply try to delete --> if it really doesnt exist, this will throw an exception + //FIXME either throw SystemElementNotFoundException here OR add check for + //SSH_FX_NO_SUCH_FILE in makeSystemMessageException() and throw SENFE there getChannel("SftpFileService.delete.rm").rm(fullPathRecoded); //$NON-NLS-1$ } else { throw e; } } if (attrs==null) { - //doesn't exist, nothing to do - return false; + //doesn't exist, throw SystemElementNotFoundException + throw new SystemElementNotFoundException(fullPath, "delete"); //$NON-NLS-1$ } else if (attrs.isDir()) { try { getChannel("SftpFileService.delete.rmdir").rmdir(fullPathRecoded); //$NON-NLS-1$ @@ -942,7 +946,6 @@ } else { throw new SystemLockTimeoutException(Activator.PLUGIN_ID); } - return true; } public void rename(String remoteParent, String oldName, String newName, IProgressMonitor monitor) throws SystemMessageException #P org.eclipse.rse.services.files.ftp Index: src/org/eclipse/rse/internal/services/files/ftp/FTPService.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/files/ftp/FTPService.java,v retrieving revision 1.67 diff -u -r1.67 FTPService.java --- src/org/eclipse/rse/internal/services/files/ftp/FTPService.java 7 May 2008 15:04:01 -0000 1.67 +++ src/org/eclipse/rse/internal/services/files/ftp/FTPService.java 23 May 2008 08:46:21 -0000 @@ -73,6 +73,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 * Javier Montalvo Orus (Symbian) - [212382] additional "initCommands" slot for ftpListingParsers extension point * Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable + * Radoslav Gerganov (ProSyst) - [230919] IFileService.delete() should not return a boolean ********************************************************************************/ package org.eclipse.rse.internal.services.files.ftp; @@ -111,6 +112,7 @@ import org.eclipse.rse.services.clientserver.NamePatternMatcher; import org.eclipse.rse.services.clientserver.PathUtility; import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage; +import org.eclipse.rse.services.clientserver.messages.SystemElementNotFoundException; import org.eclipse.rse.services.clientserver.messages.SystemLockTimeoutException; import org.eclipse.rse.services.clientserver.messages.SystemMessage; import org.eclipse.rse.services.clientserver.messages.SystemMessageException; @@ -1024,7 +1026,7 @@ /* (non-Javadoc) * @see org.eclipse.rse.services.files.IFileService#delete(org.eclipse.core.runtime.IProgressMonitor, java.lang.String, java.lang.String) */ - public boolean delete(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException { + public void delete(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException { remoteParent = checkEncoding(remoteParent); fileName = checkEncoding(fileName); @@ -1043,12 +1045,12 @@ catch (IOException e) { if (!file.exists()) - return false; + throw new SystemElementNotFoundException(file.getAbsolutePath(), "delete"); //$NON-NLS-1$ throw new RemoteFileIOException(e); } catch (SystemMessageException e) { if (!file.exists()) - return false; + throw new SystemElementNotFoundException(file.getAbsolutePath(), "delete"); //$NON-NLS-1$ throw e; } finally { @@ -1060,7 +1062,6 @@ } finally { progressMonitor.end(); } - return true; } private void internalDelete(FTPClient ftpClient, String parentPath, String fileName, boolean isFile, MyProgressMonitor monitor) #P org.eclipse.rse.services.dstore Index: src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java,v retrieving revision 1.69 diff -u -r1.69 DStoreFileService.java --- src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java 7 May 2008 12:23:04 -0000 1.69 +++ src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java 23 May 2008 08:46:23 -0000 @@ -44,6 +44,7 @@ * David McKnight (IBM) - [227406][api][dstore] need apis for getting buffer size in IDataStoreProvider * David McKnight (IBM) - [229610] [api] File transfers should use workspace text file encoding * David McKnight (IBM) - [221211] [api][breaking][files] need batch operations to indicate which operations were successful + * Radoslav Gerganov (ProSyst) - [230919] IFileService.delete() should not return a boolean *******************************************************************************/ package org.eclipse.rse.internal.services.dstore.files; @@ -1351,7 +1352,7 @@ } - public boolean delete(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException + public void delete(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException { String remotePath = remoteParent + getSeparator(remoteParent) + fileName; DataElement de = getElementFor(remotePath); @@ -1374,7 +1375,7 @@ // When running a server older than 2.0.1 success is not set for directories, so we must // check if the source message is an empty string if (sourceMsg.equals(IServiceConstants.SUCCESS) || sourceMsg.equals("")) { //$NON-NLS-1$ - return true; + return; } String msgTxt = NLS.bind(ServiceResources.FILEMSG_DELETE_FILE_FAILED, FileSystemMessageUtil.getSourceLocation(status)); String msgDetails = ServiceResources.FILEMSG_DELETE_FILE_FAILED_DETAILS; #P org.eclipse.rse.services Index: src/org/eclipse/rse/services/files/IFileService.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/IFileService.java,v retrieving revision 1.35 diff -u -r1.35 IFileService.java --- src/org/eclipse/rse/services/files/IFileService.java 7 May 2008 04:48:34 -0000 1.35 +++ src/org/eclipse/rse/services/files/IFileService.java 23 May 2008 08:46:24 -0000 @@ -25,6 +25,7 @@ * Martin Oberhuber (Wind River) - [cleanup] Fix API since tags * David Dykstal (IBM) - [221211] clarifying javadoc on batch operations * David Dykstal (IBM) - [221211] fix IFileService API for batch operations + * Radoslav Gerganov (ProSyst) - [230919] IFileService.delete() should not return a boolean *******************************************************************************/ package org.eclipse.rse.services.files; @@ -410,15 +411,13 @@ * @param remoteParent the folder containing the file to delete * @param fileName the name of the file or folder to delete * @param monitor the progress monitor - * @return true if the requested element was successfully - * deleted, or false if the element had not existed in the - * first place so the operation was a silent no-op. * @throws SystemMessageException if an error occurs or the user canceled - * the operation. + * the operation. SystemElementNotFoundException is thrown if the remote + * file doesn't exist. * * @since org.eclipse.rse.services 3.0 */ - public boolean delete(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException; + public void delete(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException; /** * Delete a set of files or folders on the host. Should throw an exception #P org.eclipse.rse.services.local Index: src/org/eclipse/rse/internal/services/local/files/LocalFileService.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/internal/services/local/files/LocalFileService.java,v retrieving revision 1.44 diff -u -r1.44 LocalFileService.java --- src/org/eclipse/rse/internal/services/local/files/LocalFileService.java 8 May 2008 21:52:30 -0000 1.44 +++ src/org/eclipse/rse/internal/services/local/files/LocalFileService.java 23 May 2008 08:46:25 -0000 @@ -37,6 +37,7 @@ * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared * Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable * David McKnight (IBM) - [231211] Local xml file not opened when workspace encoding is different from local system encoding + * Radoslav Gerganov (ProSyst) - [230919] IFileService.delete() should not return a boolean *******************************************************************************/ package org.eclipse.rse.internal.services.local.files; @@ -82,6 +83,7 @@ import org.eclipse.rse.services.clientserver.messages.CommonMessages; import org.eclipse.rse.services.clientserver.messages.ICommonMessageIds; import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage; +import org.eclipse.rse.services.clientserver.messages.SystemElementNotFoundException; import org.eclipse.rse.services.clientserver.messages.SystemMessage; import org.eclipse.rse.services.clientserver.messages.SystemMessageException; import org.eclipse.rse.services.clientserver.messages.SystemOperationCancelledException; @@ -1016,7 +1018,7 @@ return new LocalVirtualHostFile(child); } - public boolean delete(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException + public void delete(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException { if (fileName.endsWith(ArchiveHandlerManager.VIRTUAL_SEPARATOR)) { @@ -1045,12 +1047,15 @@ { result = fileToDelete.delete(); } - if (!result && fileToDelete.exists()) { - // Deletion failed without specification why... likely a Security - // problem? - throw new RemoteFileSecurityException(null); + if (!result) { + if (fileToDelete.exists()) { + // Deletion failed without specification why... likely a Security + // problem? + throw new RemoteFileSecurityException(null); + } else { + throw new SystemElementNotFoundException(fileToDelete.getAbsolutePath(), "delete"); //$NON-NLS-1$ + } } - return result; } public void deleteBatch(String[] remoteParents, String[] fileNames, IProgressMonitor monitor) throws SystemMessageException