Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8024695 new File("").exists() returns false whereas it is the current working directory
  3. JDK-8350702

Release Note: java.io.File treats the empty pathname as the current user directory

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Delivered
    • Icon: P4 P4
    • 25
    • 25
    • core-libs
    • generic
    • generic

      The `java.io.File` class is changed so that an instance of `File` created from the empty abstract pathname ("") now behaves consistently like a `File` created from the current user directory. Long standing behavior was for some methods to fail for the empty pathname. The change means that the `canRead`, `exists` and `isDirectory` methods return `true` instead of failing with `false`, and the `getFreeSpace`, `lastModified` and `length` methods return the expected values instead of zero. Methods such as `setReadable` and `setLastModified` will attempt to change the file's attributes instead of failing. WIth this change, `java.io.File` now matches the behavior of the `java.nio.file` API.

            bpb Brian Burkhalter
            bpb Brian Burkhalter
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: