Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-16226

new Path(String str) does not remove all the trailing slashes of str

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

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 3.3.0, 3.2.1
    • fs
    • None
    • Reviewed

    Description

      new Path(String str) calls Path.normalizePath to normalize the str, however, it does not remove all the slashes of the str.

      Path.java
        /**
         * Normalize a path string to use non-duplicated forward slashes as
         * the path separator and remove any trailing path separators.
         *
         * @param scheme the URI scheme. Used to deduce whether we
         * should replace backslashes or not
         * @param path the scheme-specific part
         * @return the normalized path string
         */
        private static String normalizePath(String scheme, String path) {
      

      Javadoc says "remove any trailing path separators", but it removes only one trailing slash.

      Credit: This issue was found by Ayush Saxena in HDFS-14369.

      Attachments

        1. HADOOP-16226.002.patch
          3 kB
          Akira Ajisaka
        2. HADOOP-16226.001.patch
          3 kB
          Akira Ajisaka

        Issue Links

        Activity

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

          People

            aajisaka Akira Ajisaka
            aajisaka Akira Ajisaka
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment