1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-23 08:13:50 +02:00

[191048] Remote files locally listed and being removed by other users should be reported as missing

[198182] FTP export problem: RSEF8057E: Error occurred while exporting FILENAME: Operation failed. File system input or output error
[197758] Unix symbolic links are not classified as file vs. folder
This commit is contained in:
Javier Montalvo Orus 2007-07-30 16:37:48 +00:00
parent e92a4e9ed7
commit 4c3260b888
4 changed files with 58 additions and 32 deletions

View file

@ -17,6 +17,7 @@
* anonymous on ftp.wacom.com * anonymous on ftp.wacom.com
* Javier Montalvo Orus (Symbian) - Fixing 161238 - [ftp] connections to VMS servers are not usable * Javier Montalvo Orus (Symbian) - Fixing 161238 - [ftp] connections to VMS servers are not usable
* Javier Montalvo Orus (Symbian) - Fixing 176216 - [api] FTP sould provide API to allow clients register their own FTPListingParser * Javier Montalvo Orus (Symbian) - Fixing 176216 - [api] FTP sould provide API to allow clients register their own FTPListingParser
* Javier Montalvo Orus (Symbian) - [197758] Unix symbolic links are not classified as file vs. folder
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.services.files.ftp; package org.eclipse.rse.internal.services.files.ftp;
@ -34,6 +35,7 @@ public class FTPHostFile implements IHostFile
private String _name; private String _name;
private String _parentPath; private String _parentPath;
private boolean _isDirectory; private boolean _isDirectory;
private boolean _isLink;
private boolean _isArchive; private boolean _isArchive;
private long _lastModified; private long _lastModified;
private long _size; private long _size;
@ -65,6 +67,7 @@ public class FTPHostFile implements IHostFile
_name = ftpFile.getName(); _name = ftpFile.getName();
_isDirectory = ftpFile.isDirectory(); _isDirectory = ftpFile.isDirectory();
_isLink = ftpFile.isSymbolicLink();
_lastModified = ftpFile.getTimestamp().getTimeInMillis(); _lastModified = ftpFile.getTimestamp().getTimeInMillis();
_size = ftpFile.getSize(); _size = ftpFile.getSize();
_isArchive = internalIsArchive(); _isArchive = internalIsArchive();
@ -92,6 +95,11 @@ public class FTPHostFile implements IHostFile
return !(_isDirectory || _isRoot); return !(_isDirectory || _isRoot);
} }
public boolean isSymbolicLink()
{
return _isLink;
}
public String getName() public String getName()
{ {
return _name; return _name;
@ -234,4 +242,9 @@ public class FTPHostFile implements IHostFile
&& !ArchiveHandlerManager.isVirtual(getAbsolutePath()); && !ArchiveHandlerManager.isVirtual(getAbsolutePath());
} }
public void setIsDirectory(boolean isDirectory)
{
_isDirectory = isDirectory;
}
} }

View file

@ -49,6 +49,8 @@
* Javier Montalvo Orus (Symbian) - [191048] Remote files locally listed and being removed by other users should be reported as missing * Javier Montalvo Orus (Symbian) - [191048] Remote files locally listed and being removed by other users should be reported as missing
* Javier Montalvo Orus (Symbian) - [195677] Rename fails on WFTPD-2.03 * Javier Montalvo Orus (Symbian) - [195677] Rename fails on WFTPD-2.03
* Javier Montalvo Orus (Symbian) - [197105] Directory listing fails on Solaris when special devices are in a directory * Javier Montalvo Orus (Symbian) - [197105] Directory listing fails on Solaris when special devices are in a directory
* Javier Montalvo Orus (Symbian) - [197758] Unix symbolic links are not classified as file vs. folder
* Javier Montalvo Orus (Symbian) - [198182] FTP export problem: RSEF8057E: Error occurred while exporting FILENAME: Operation failed. File system input or output error
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.services.files.ftp; package org.eclipse.rse.internal.services.files.ftp;
@ -57,6 +59,7 @@ import java.io.BufferedInputStream;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -71,6 +74,7 @@ import org.apache.commons.net.ftp.FTPClientConfig;
import org.apache.commons.net.ftp.FTPFile; import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.net.ftp.FTPReply; import org.apache.commons.net.ftp.FTPReply;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
import org.eclipse.rse.core.model.IPropertySet; import org.eclipse.rse.core.model.IPropertySet;
import org.eclipse.rse.internal.services.files.ftp.parser.IFTPClientConfigFactory; import org.eclipse.rse.internal.services.files.ftp.parser.IFTPClientConfigFactory;
@ -394,7 +398,7 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
{ {
if (monitor!=null){ if (monitor!=null){
if (monitor.isCanceled()) { if (monitor.isCanceled()) {
return null; throw new RemoteFileCancelledException();
} }
} }
@ -465,7 +469,7 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
{ {
if (monitor!=null){ if (monitor!=null){
if (monitor.isCanceled()) { if (monitor.isCanceled()) {
return null; throw new RemoteFileCancelledException();
} }
} }
@ -509,8 +513,17 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
_ftpLoggingOutputStream.write(rawListLine.getBytes()); _ftpLoggingOutputStream.write(rawListLine.getBytes());
FTPHostFile f = new FTPHostFile(parentPath, _ftpFiles[i]); FTPHostFile f = new FTPHostFile(parentPath, _ftpFiles[i]);
String name = f.getName();
if(f.isSymbolicLink()) {
if(name.indexOf('.')==-1) {
//modify FTPHostFile to be shown as a folder
f.setIsDirectory(true);
}
}
if (isRightType(fileType,f)) { if (isRightType(fileType,f)) {
String name = f.getName();
if (name.equals(".") || name.equals("..")) { //$NON-NLS-1$ //$NON-NLS-2$ if (name.equals(".") || name.equals("..")) { //$NON-NLS-1$ //$NON-NLS-2$
//Never return the default directory names //Never return the default directory names
continue; continue;
@ -562,9 +575,12 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
if (monitor!=null){ if (monitor!=null){
if (monitor.isCanceled()) { if (monitor.isCanceled()) {
return false; throw new RemoteFileCancelledException();
} }
} }
else{
monitor = new NullProgressMonitor();
}
if(_commandMutex.waitForLock(monitor, Long.MAX_VALUE)) if(_commandMutex.waitForLock(monitor, Long.MAX_VALUE))
{ {
@ -674,22 +690,12 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
if (monitor!=null){ if (monitor!=null){
if (monitor.isCanceled()) { if (monitor.isCanceled()) {
return false; throw new RemoteFileCancelledException();
} }
} }
IHostFile remoteHostFile = getFile(remoteParent,remoteFile,null); IHostFile remoteHostFile = getFile(remoteParent,remoteFile,null);
if(remoteHostFile == null)
{
return false;
}
if(!remoteHostFile.exists())
{
throw new RemoteFileIOException(new Exception(FTPServiceResources.FTPService_FTP_File_Service_Not_Found));
}
if(_commandMutex.waitForLock(monitor, Long.MAX_VALUE)) if(_commandMutex.waitForLock(monitor, Long.MAX_VALUE))
{ {
try try
@ -703,21 +709,22 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
ftpClient.changeWorkingDirectory(remoteParent); ftpClient.changeWorkingDirectory(remoteParent);
setFileType(isBinary); setFileType(isBinary);
if (!localFile.exists())
{
File localParentFile = localFile.getParentFile();
if (!localParentFile.exists())
{
localParentFile.mkdirs();
}
localFile.createNewFile();
}
output = new FileOutputStream(localFile);
input = ftpClient.retrieveFileStream(remoteFile); input = ftpClient.retrieveFileStream(remoteFile);
if(input != null) if(input != null)
{ {
if (!localFile.exists())
{
File localParentFile = localFile.getParentFile();
if (!localParentFile.exists())
{
localParentFile.mkdirs();
}
localFile.createNewFile();
}
output = new FileOutputStream(localFile);
progressMonitor.init(0, remoteFile, localFile.getName(), remoteHostFile.getSize()); progressMonitor.init(0, remoteFile, localFile.getName(), remoteHostFile.getSize());
byte[] buffer = new byte[4096]; byte[] buffer = new byte[4096];
int readCount; int readCount;
@ -740,12 +747,22 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
output.close(); output.close();
ftpClient.completePendingCommand(); ftpClient.completePendingCommand();
}
else
{
throw new RemoteFileIOException(new Exception(ftpClient.getReplyString()));
} }
} }
catch (Exception e) catch (FileNotFoundException e)
{ {
throw new RemoteFileIOException(e); throw new RemoteFileIOException(e);
} finally }
catch (IOException e)
{
throw new RemoteFileIOException(e);
}
finally
{ {
_commandMutex.release(); _commandMutex.release();
} }

View file

@ -12,7 +12,6 @@
* *
* Contributors: * Contributors:
* Javier Montalvo Orus (Symbian) - Added Externalized Strings * Javier Montalvo Orus (Symbian) - Added Externalized Strings
* Javier Montalvo Orus (Symbian) - [191048] Remote files locally listed and being removed by other users should be reported as missing
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.services.files.ftp; package org.eclipse.rse.internal.services.files.ftp;
@ -29,7 +28,6 @@ public class FTPServiceResources extends NLS
public static String FTP_File_Service_Monitor_Format; public static String FTP_File_Service_Monitor_Format;
public static String FTP_File_Service_Name; public static String FTP_File_Service_Name;
public static String FTP_File_Service_Description; public static String FTP_File_Service_Description;
public static String FTPService_FTP_File_Service_Not_Found;
static { static {
// load message values from bundle file // load message values from bundle file

View file

@ -12,7 +12,6 @@
# #
# Contributors: # Contributors:
# Javier Montalvo Orus (Symbian) - Added Externalized Strings # Javier Montalvo Orus (Symbian) - Added Externalized Strings
# Javier Montalvo Orus (Symbian) - [191048] Remote files locally listed and being removed by other users should be reported as missing
################################################################################ ################################################################################
# NLS_MESSAGEFORMAT_VAR # NLS_MESSAGEFORMAT_VAR
@ -24,5 +23,4 @@ FTP_File_Service_Deleting_Task=Deleting
FTP_File_Service_Copy_Not_Supported=FTP copy not supported, use move instead FTP_File_Service_Copy_Not_Supported=FTP copy not supported, use move instead
FTP_File_Service_Listing_Job=Listing files... FTP_File_Service_Listing_Job=Listing files...
FTP_File_Service_Listing_Job_Success=Success FTP_File_Service_Listing_Job_Success=Success
FTPService_FTP_File_Service_Not_Found=File not found
FTP_File_Service_Monitor_Format={0,number,integer} KB of {1,number,integer} KB complete ({2,number,percent}) FTP_File_Service_Monitor_Format={0,number,integer} KB of {1,number,integer} KB complete ({2,number,percent})