Summary
Add a system property jdk.io.File.failIfEmptyPath which when true will cause various java.io.File methods to revert to their behavior prior to JDK-8024695 with respect to the empty path.
Problem
The commit which resolved JDK-8024695 caused a number of failures in JDK 25 in external libraries which were relying on observable legacy inconsistent, undocumented behavior of a java.io.File which was created from an empty path. The File class was changed to consider an empty pathname string as being equivalent to the current working directory. This resulted in applications depending on those libraries encountering errors they could not circumvent.
Solution
Add a system property jdk.io.File.failIfEmptyPath to make java.io.File handle the empty path as it did prior to JDK 25.
Specification
There is no specification change. The system property, if set, merely causes access to the current directory (as implied by an empty pathname string) to fail.
- csr of
-
JDK-8370216 Fix of new File("").exists() causes undefined behavior in libraries
-
- In Progress
-
- relates to
-
JDK-8024695 new File("").exists() returns false whereas it is the current working directory
-
- Resolved
-