You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Hadoop QA (JIRA)" <ji...@apache.org> on 2015/05/02 06:58:06 UTC

[jira] [Commented] (HADOOP-8653) FTPFileSystem rename broken

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

Hadoop QA commented on HADOOP-8653:
-----------------------------------

\\
\\
| (x) *{color:red}-1 overall{color}* |
\\
\\
|| Vote || Subsystem || Runtime || Comment ||
| {color:red}-1{color} | patch |   0m  0s | The patch command could not apply the patch during dryrun. |
\\
\\
|| Subsystem || Report/Notes ||
| Patch URL | http://issues.apache.org/jira/secure/attachment/12539796/HDFS-8653-1.patch |
| Optional Tests | javadoc javac unit findbugs checkstyle |
| git revision | trunk / f1a152c |
| Console output | https://builds.apache.org/job/PreCommit-HADOOP-Build/6360/console |


This message was automatically generated.

> FTPFileSystem rename broken
> ---------------------------
>
>                 Key: HADOOP-8653
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8653
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: fs
>    Affects Versions: 0.20.2, 2.0.0-alpha
>            Reporter: Karel Kolman
>         Attachments: HDFS-8653-1.patch
>
>
> The FTPFileSystem.rename(FTPClient client, Path src, Path dst) method is broken.
> The changeWorkingDirectory command underneath is being passed a string with file:// uri prefix (which FTP server does not understand obviously)
> {noformat}
> INFO [2012-08-06 12:59:39] (DefaultSession.java:297) - Received command: [CWD ftp://localhost:61246/tmp/myfile]
>  WARN [2012-08-06 12:59:39] (AbstractFakeCommandHandler.java:213) - Error handling command: Command[CWD:[ftp://localhost:61246/tmp/myfile]]; org.mockftpserver.fake.filesystem.FileSystemException: /ftp://localhost:61246/tmp/myfile
> org.mockftpserver.fake.filesystem.FileSystemException: /ftp://localhost:61246/tmp/myfile
> 	at org.mockftpserver.fake.command.AbstractFakeCommandHandler.verifyFileSystemCondition(AbstractFakeCommandHandler.java:264)
> 	at org.mockftpserver.fake.command.CwdCommandHandler.handle(CwdCommandHandler.java:44)
> 	at org.mockftpserver.fake.command.AbstractFakeCommandHandler.handleCommand(AbstractFakeCommandHandler.java:76)
> 	at org.mockftpserver.core.session.DefaultSession.readAndProcessCommand(DefaultSession.java:421)
> 	at org.mockftpserver.core.session.DefaultSession.run(DefaultSession.java:384)
> 	at java.lang.Thread.run(Thread.java:680)
> {noformat}
> The solution would be this:
> {noformat}
> --- a/FTPFileSystem.java
> +++ b/FTPFileSystem.java
> @@ -549,15 +549,15 @@ public class FTPFileSystem extends FileSystem {
>        throw new IOException("Destination path " + dst
>            + " already exist, cannot rename!");
>      }
> -    String parentSrc = absoluteSrc.getParent().toUri().toString();
> -    String parentDst = absoluteDst.getParent().toUri().toString();
> +    URI parentSrc = absoluteSrc.getParent().toUri();
> +    URI parentDst = absoluteDst.getParent().toUri();
>      String from = src.getName();
>      String to = dst.getName();
> -    if (!parentSrc.equals(parentDst)) {
> +    if (!parentSrc.toString().equals(parentDst.toString())) {
>        throw new IOException("Cannot rename parent(source): " + parentSrc
>            + ", parent(destination):  " + parentDst);
>      }
> -    client.changeWorkingDirectory(parentSrc);
> +    client.changeWorkingDirectory(parentSrc.getPath().toString());
>      boolean renamed = client.rename(from, to);
>      return renamed;
>    }
> {noformat}



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