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

Log workAgile BoardRank to TopRank to BottomAttach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.3.0, 3.2.1
    • Component/s: fs
    • Labels:
      None
    • Target Version/s:
    • Hadoop Flags:
      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

        Issue Links

          Activity

          $i18n.getText('security.level.explanation', $currentSelection) Viewable by All Users
          Cancel

            People

            • Assignee:
              aajisaka Akira Ajisaka Assign to me
              Reporter:
              aajisaka Akira Ajisaka

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment