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

(fs) Path.of should allow input to include long path prefix

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 21
    • core-libs
    • None
    • behavioral
    • minimal
    • Minimal risk as certain absolute paths previously rejected will now be accepted.
    • Java API
    • JDK

      Summary

      Creation of a Path from a String using java.nio.file.Path.of(String) is now changed to accept strings with the long path prefix \\?\ and the long UNC path prefix \\?\UNC\ on Windows.

      Problem

      On Windows, Path::of accepts a long absolute path string, but rejects the same string when prefixed with \\?\. The same situation applies to long UNC path strings which instead use the prefix \\?\UNC\.

      Solution

      If a long path prefix \\?\ or long UNC path prefix \\?\UNC\ is detected, then do not reject the string a priori, but instead strip the prefix, examine the remainder of the string, and accept it if it represents an absolute path in the former case, or a UNC path in the latter.

      Specification

      There is no visible change to the specification.

            bpb Brian Burkhalter
            alanb Alan Bateman
            Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: