Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-14583

FileStatus#toString() will throw IllegalArgumentException

VotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.3.0
    • None
    • Reviewed

    Description

      FileStatus#toString() will throw IllegalArgumentException, stack and error message like this:

      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)
      

      Test Code like this:

      @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());
      }

       

      Attachments

        1. HDFS-14583-trunk-0001.patch
          3 kB
          ZanderXu
        2. HDFS-14583-trunk-002.patch
          3 kB
          ZanderXu
        3. HDFS-14583-trunk-003.patch
          4 kB
          ZanderXu

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            xuzq_zander ZanderXu
            xuzq_zander ZanderXu
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment