Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8354409

Parsing a file path on Windows with a trailing space in a name element ("...\ kjdd ggf \...") is rejected

XMLWordPrintable

    • x86_64
    • windows_10

      A DESCRIPTION OF THE PROBLEM :
      Attempt to construct a Path instance of e.g. 'c:\temp\ kljdsj \file.tmp' - with space at beginnig or end of a path element causes validation failure.
      From another side, new File("c:\\temp\\ kljdsj \\file.tmp") allows to operate referenced file as usual and file system has no problems with such file names.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Path.of("c:\\temp").resolve("eruyer \\file.tmp")

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Instance of Path["c:\temp\eruyer \file.tmp"] is successfully constructed
      ACTUAL -
      Path.of("c:\\temp").resolve("eruyer \\file.tmp") -> InvalidPathException, even if referenced file exists

      ---------- BEGIN SOURCE ----------
      Path.of("c:\\temp").resolve("eruyer \\file.tmp");
      ---------- END SOURCE ----------

            bpb Brian Burkhalter
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: