RFR: 8024695: new File("").exists() returns false whereas it is the current working directory [v7]

Daniel Fuchs dfuchs at openjdk.org
Mon Feb 24 10:16:52 UTC 2025


On Fri, 21 Feb 2025 17:04:11 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> src/java.base/unix/classes/java/io/UnixFileSystem.java line 37:
>> 
>>> 35: 
>>> 36:     private String getPathForSysCalls(String path) {
>>> 37:         return path.isEmpty() ? getCWD().getPath() : path;
>> 
>> The Windows implementation has a guard for path == null. Is it superfluous there, or should it be added here?
>> 
>>     private String getPathForWin32Calls(String path) {
>>         return (path != null && path.isEmpty()) ? getCWD().getPath() : path;
>>     }
>
> Without the `null` check on Windows there were test failures which I do not see on Unix.

OK - let's not poke the beast ;-)

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/22821#discussion_r1967346641


More information about the core-libs-dev mailing list