mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-14 20:45:22 +02:00
[240738][ftp] Incorrect behavior on getFile for non-existing folder
This commit is contained in:
parent
0f7297d016
commit
3e31d2f8cd
1 changed files with 26 additions and 17 deletions
|
@ -78,6 +78,7 @@
|
||||||
* Martin Oberhuber (Wind River) - [234045] FTP Permission Error Handling
|
* Martin Oberhuber (Wind River) - [234045] FTP Permission Error Handling
|
||||||
* Martin Oberhuber (Wind River) - [235463][ftp][dstore] Incorrect case sensitivity reported on windows-remote
|
* Martin Oberhuber (Wind River) - [235463][ftp][dstore] Incorrect case sensitivity reported on windows-remote
|
||||||
* Martin Oberhuber (Wind River) - [235360][ftp][ssh][local] Return proper "Root" IHostFile
|
* Martin Oberhuber (Wind River) - [235360][ftp][ssh][local] Return proper "Root" IHostFile
|
||||||
|
* Martin Oberhuber (Wind River) - [240738][ftp] Incorrect behavior on getFile for non-existing folder
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.services.files.ftp;
|
package org.eclipse.rse.internal.services.files.ftp;
|
||||||
|
@ -620,39 +621,47 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
||||||
|
|
||||||
if(!_ftpClient.changeWorkingDirectory(remoteParent))
|
if(!_ftpClient.changeWorkingDirectory(remoteParent))
|
||||||
{
|
{
|
||||||
throw new RemoteFileIOException(new Exception(_ftpClient.getReplyString()));
|
String reply = _ftpClient.getReplyString();
|
||||||
|
if (reply != null && reply.startsWith("550")) { //$NON-NLS-1$
|
||||||
|
// No such file or directory
|
||||||
|
throw new SystemElementNotFoundException(remoteParent, "chdir"); //$NON-NLS-1$
|
||||||
|
} else {
|
||||||
|
throw new RemoteFileIOException(new Exception(reply));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!listFiles(monitor))
|
if(!listFiles(monitor))
|
||||||
{
|
{
|
||||||
throw new SystemOperationCancelledException();
|
throw new SystemOperationCancelledException();
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized (_fCachePreviousFiles) {
|
synchronized (_fCachePreviousFiles) {
|
||||||
cacheFiles(remoteParent);
|
cacheFiles(remoteParent);
|
||||||
|
|
||||||
//Bug 198645: try exact match first
|
// Bug 198645: try exact match first
|
||||||
Object o = _fCachePreviousFiles.get(fileName);
|
Object o = _fCachePreviousFiles.get(fileName);
|
||||||
if (o!=null) return (FTPHostFile)o;
|
if (o!=null) return (FTPHostFile)o;
|
||||||
|
|
||||||
//try case insensitive match (usually never executed)
|
// try case insensitive match (usually never executed)
|
||||||
if (!isCaseSensitive()) {
|
if (!isCaseSensitive()) {
|
||||||
for (int i = 0; i < _ftpFiles.length; i++) {
|
for (int i = 0; i < _ftpFiles.length; i++) {
|
||||||
String tempName = _ftpFiles[i].getName();
|
String tempName = _ftpFiles[i].getName();
|
||||||
if (tempName.equalsIgnoreCase(fileName)) {
|
if (tempName.equalsIgnoreCase(fileName)) {
|
||||||
file = (FTPHostFile) _fCachePreviousFiles.get(tempName);
|
file = (FTPHostFile) _fCachePreviousFiles.get(tempName);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if not found, create new object with non-existing flag
|
// if not found, create new object with non-existing flag
|
||||||
if(file == null)
|
if(file == null)
|
||||||
{
|
{
|
||||||
file = new FTPHostFile(remoteParent,fileName, false, false, 0, 0, false);
|
file = new FTPHostFile(remoteParent,fileName, false, false, 0, 0, false);
|
||||||
}
|
}
|
||||||
|
} catch (SystemElementNotFoundException senfe) {
|
||||||
|
// Return non-existing file
|
||||||
|
file = new FTPHostFile(remoteParent, fileName, false, false, 0, 0, false);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RemoteFileIOException(e);
|
throw new RemoteFileIOException(e);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -1372,7 +1381,7 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
||||||
public void setIsCaseSensitive(boolean b) {
|
public void setIsCaseSensitive(boolean b) {
|
||||||
_caseSensitive = b;
|
_caseSensitive = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCaseSensitive()
|
public boolean isCaseSensitive()
|
||||||
{
|
{
|
||||||
return _caseSensitive;
|
return _caseSensitive;
|
||||||
|
|
Loading…
Add table
Reference in a new issue