You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2014/11/29 03:42:12 UTC

[jira] [Commented] (NET-545) deleteFile always returns true

    [ https://issues.apache.org/jira/browse/NET-545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14228604#comment-14228604 ] 

Sebb commented on NET-545:
--------------------------

The method completePendingCommand() should only be needed after a command that returns intermediate results.

It fetches the final reply.

deleteFile() already fetches the reply.

So either the server is returning additional data after the delete, or the app sent a previous command whose reply had not been fetched.

If you wish to debug this further, add a PrintCommandListener (see examples for details).

> deleteFile always returns true
> ------------------------------
>
>                 Key: NET-545
>                 URL: https://issues.apache.org/jira/browse/NET-545
>             Project: Commons Net
>          Issue Type: Bug
>          Components: FTP
>    Affects Versions: 3.3
>         Environment: VsFTPd 2.0.5 @Oracle Enterise Linux 2.6.18-194.3.1.0.1.el5xen #1 SMP Thu May 6 20:22:34 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
>            Reporter: Pavel Kostelnik
>            Priority: Minor
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> [UPDATE]
> Ok, it seems that completePendingCommand(); fixes things. Still I think by default it would be good to wait for this to finish. Plus the javadoc is EXTREMLY misleading (for deleteFile it says "Returns:
> True if successfully completed, false if not.")
> The deleteFile always returns true, even if the file is not deleted.
> result = ftpClient.deleteFile(targetDir+"/"+fileName);
> --> the variable "result" is always true...
> My test code is following:
> boolean result = ftpClient.deleteFile(targetDir+"/"+fileName);
> System.out.println(result); //THIS IS ALWAYS true, even if the file is not deleted
> System.out.println(ftpClient.getReplyString()); // reply string for PREVIOUS operation is shown
> int res = ftpClient.getReply(); // I have to call this to get the actual reply for delete command
> System.out.println(res+ "aadfasd"); //550
> System.out.println(ftpClient.getReplyCode()); //550
> System.out.println(ftpClient.getReplyString());//550 Delete operation failed.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)