mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Fixing 161211 - Cannot expand /pub folder as anonymous on ftp.wacom.com
This commit is contained in:
parent
07421cba57
commit
a35ee51bd0
2 changed files with 42 additions and 13 deletions
|
@ -13,6 +13,8 @@
|
|||
* Contributors:
|
||||
* Michael Berger (IBM) - Fixing 140408 - FTP upload does not work
|
||||
* Javier Montalvo Orús (Symbian) - Migrate to jakarta commons net FTP client
|
||||
* Javier Montalvo Orus (Symbian) - Fixing 161211 - Cannot expand /pub folder as
|
||||
* anonymous on ftp.wacom.com
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.services.files.ftp;
|
||||
|
@ -33,8 +35,8 @@ public class FTPHostFile implements IHostFile
|
|||
private boolean _isArchive;
|
||||
private long _lastModified;
|
||||
private long _size;
|
||||
private boolean _canRead;
|
||||
private boolean _canWrite;
|
||||
private boolean _canRead = true;
|
||||
private boolean _canWrite = true;
|
||||
private boolean _isRoot;
|
||||
private boolean _exists;
|
||||
|
||||
|
@ -52,7 +54,7 @@ public class FTPHostFile implements IHostFile
|
|||
_exists = exists;
|
||||
}
|
||||
|
||||
public FTPHostFile(String parentPath, FTPFile ftpFile)
|
||||
public FTPHostFile(String parentPath, FTPFile ftpFile, String systemName)
|
||||
{
|
||||
_parentPath = parentPath;
|
||||
_name = ftpFile.getName();
|
||||
|
@ -60,8 +62,13 @@ public class FTPHostFile implements IHostFile
|
|||
_lastModified = ftpFile.getTimestamp().getTimeInMillis();
|
||||
_size = ftpFile.getSize();
|
||||
_isArchive = internalIsArchive();
|
||||
_canRead = ftpFile.hasPermission(FTPFile.USER_ACCESS, FTPFile.READ_PERMISSION);
|
||||
_canWrite = ftpFile.hasPermission(FTPFile.USER_ACCESS, FTPFile.WRITE_PERMISSION);
|
||||
|
||||
if(!systemName.toUpperCase().startsWith("WINDOWS"))
|
||||
{
|
||||
_canRead = ftpFile.hasPermission(FTPFile.USER_ACCESS, FTPFile.READ_PERMISSION);
|
||||
_canWrite = ftpFile.hasPermission(FTPFile.USER_ACCESS, FTPFile.WRITE_PERMISSION);
|
||||
}
|
||||
|
||||
_isRoot = false;
|
||||
_exists = true;
|
||||
}
|
||||
|
|
|
@ -12,11 +12,13 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Michael Berger (IBM) - Fixing 140408 - FTP upload does not work
|
||||
* Javier Montalvo Orús (Symbian) - Fixing 140323 - provided implementation for
|
||||
* Javier Montalvo Orus (Symbian) - Fixing 140323 - provided implementation for
|
||||
* delete, move and rename.
|
||||
* Javier Montalvo Orús (Symbian) - Bug 140348 - FTP did not use port number
|
||||
* Javier Montalvo Orus (Symbian) - Bug 140348 - FTP did not use port number
|
||||
* Michael Berger (IBM) - Fixing 140404 - FTP new file creation does not work
|
||||
* Javier Montalvo Orús (Symbian) - Migrate to jakarta commons net FTP client
|
||||
* Javier Montalvo Orus (Symbian) - Migrate to jakarta commons net FTP client
|
||||
* Javier Montalvo Orus (Symbian) - Fixing 161211 - Cannot expand /pub folder as
|
||||
* anonymous on ftp.wacom.com
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.services.files.ftp;
|
||||
|
@ -190,7 +192,12 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
|
|||
ftp = getFTPClient();
|
||||
}
|
||||
|
||||
ftp.changeWorkingDirectory(parentPath);
|
||||
if(!ftp.changeWorkingDirectory(parentPath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
String systemName = ftp.getSystemName();
|
||||
|
||||
FTPFile[] ftpFiles = ftp.listFiles();
|
||||
|
||||
|
@ -198,7 +205,7 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
|
|||
{
|
||||
if(filematcher.matches(ftpFiles[i].getName()))
|
||||
{
|
||||
results.add(new FTPHostFile(parentPath,ftpFiles[i]));
|
||||
results.add(new FTPHostFile(parentPath,ftpFiles[i],systemName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -337,8 +344,15 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
|
|||
|
||||
try {
|
||||
getFTPClient().cwd(remoteParent);
|
||||
int returnedValue = getFTPClient().dele(fileName);
|
||||
hasSucceeded = (returnedValue > 0);
|
||||
|
||||
//attempt to remove an empty folder folder
|
||||
hasSucceeded = getFTPClient().removeDirectory(fileName);
|
||||
|
||||
if(!hasSucceeded)
|
||||
{
|
||||
//attempt to remove a file
|
||||
hasSucceeded = getFTPClient().deleteFile(fileName);
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
// Changing folder raised an exception
|
||||
|
@ -355,7 +369,15 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
|
|||
|
||||
try {
|
||||
|
||||
getFTPClient().rename(remoteParent + getSeparator() + oldName, remoteParent + getSeparator() + newName);
|
||||
if(newName.startsWith("/"))
|
||||
{
|
||||
getFTPClient().rename(remoteParent + getSeparator() + oldName, newName);
|
||||
}
|
||||
else
|
||||
{
|
||||
getFTPClient().rename(remoteParent + getSeparator() + oldName, remoteParent + getSeparator() + newName);
|
||||
}
|
||||
|
||||
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
|
|
Loading…
Add table
Reference in a new issue