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

FsUrlStreamHandlerFactory "Illegal character in path" parsing file URL on Windows

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.7.3, 2.6.5, 3.0.0-alpha2
    • None
    • fs
    • None
    • Windows

    Description

      After registering the FsUrlStreamHandlerFactory with the JVM, subsequent calls to convert a "file" URL to a URI can fail with "Illegal character in path" where the illegal character is a backslash.

      For example:

      URL.setURLStreamHandlerFactory(new FsUrlStreamHandlerFactory());
      File file = new File("C:/Users");
      final URL url = new URL("file:///" + file.getAbsolutePath());
      

      gives stack trace:

      java.net.URISyntaxException: Illegal character in path at index 8: file:/C:\Users
          at java.net.URI$Parser.fail(URI.java:2848)
          at java.net.URI$Parser.checkChars(URI.java:3021)
          at java.net.URI$Parser.parseHierarchical(URI.java:3105)
          at java.net.URI$Parser.parse(URI.java:3053)
          at java.net.URI.<init>(URI.java:588)
          at java.net.URL.toURI(URL.java:946)
      

      Attachments

        1. HADOOP-14157.001.patch
          4 kB
          Simon Scott

        Activity

          People

            Unassigned Unassigned
            simonscottuk Simon Scott
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated: