[ https://issues.apache.org/jira/browse/HDFS-14583?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16909704#comment-16909704 ]
He Xiaoqiao commented on HDFS-14583: ------------------------------------ Thanks [~xuzq_zander] for your report and contribution. I prefer to fix at {{RouterClientProtocol}} rather than {{HdfsFileStatus}}. In my opinion, HdfsFileStatus do not accept empty symlink as expect. IIUC, in RouterClientProtocol, it is not necessary to set {{symlink}} as following. FYI. cc [~elgoiri]. {code:java} return new HdfsFileStatus.Builder() .isdir(true) .mtime(modTime) .atime(accessTime) .perm(permission) .owner(owner) .group(group) .path(DFSUtil.string2Bytes(name)) .fileId(inodeId) .children(childrenNum) .build(); {code} > FileStatus#toString() will throw IllegalArgumentException > --------------------------------------------------------- > > Key: HDFS-14583 > URL: https://issues.apache.org/jira/browse/HDFS-14583 > Project: Hadoop HDFS > Issue Type: Bug > Reporter: xuzq > Assignee: xuzq > Priority: Major > Labels: HDFS > Attachments: HDFS-14583-trunk-0001.patch > > > FileStatus#toString() will throw IllegalArgumentException, stack and error > message like this: > {code:java} > java.lang.IllegalArgumentException: Can not create a Path from an empty string > at org.apache.hadoop.fs.Path.checkPathArg(Path.java:172) > at org.apache.hadoop.fs.Path.<init>(Path.java:184) > at > org.apache.hadoop.hdfs.protocol.HdfsLocatedFileStatus.getSymlink(HdfsLocatedFileStatus.java:117) > at org.apache.hadoop.fs.FileStatus.toString(FileStatus.java:462) > at > org.apache.hadoop.hdfs.web.TestJsonUtil.testHdfsFileStatus(TestJsonUtil.java:123) > {code} > Test Code like this: > {code:java} > @Test > public void testHdfsFileStatus() throws IOException { > HdfsFileStatus hdfsFileStatus = new HdfsFileStatus.Builder() > .replication(1) > .blocksize(1024) > .perm(new FsPermission((short) 777)) > .owner("owner") > .group("group") > .symlink(new byte[0]) > .path(new byte[0]) > .fileId(1010) > .isdir(true) > .build(); > System.out.println("HdfsFileStatus = " + hdfsFileStatus.toString()); > }{code} > -- This message was sent by Atlassian JIRA (v7.6.14#76016) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org