RFR: 8349812: (fs) Files.newByteChannel with empty path name and CREATE_NEW throws unexpected exception [v3]
Maxim Kartashev
mkartashev at openjdk.org
Wed Feb 12 10:13:27 UTC 2025
> `UnixFileChannelFactory.open()` checks for the current directory by looking at the first byte of the name, which in case of an empty path is simply not there. This check throws an `ArrayIndexOutOfBoundsException` and prevents the correct exception from being thrown.
>
> The suggested solution is to use another method that translates a path name into a byte array called `getByteArrayForSysCalls()` that is specifically designed to handle the case of empty path names.
>
> Tested by running `java/nio` tests on Linux.
Maxim Kartashev has updated the pull request incrementally with one additional commit since the last revision:
Extended the test for empty path name
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/23560/files
- new: https://git.openjdk.org/jdk/pull/23560/files/d0d42a4d..c415adae
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=23560&range=02
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=23560&range=01-02
Stats: 15 lines in 1 file changed: 13 ins; 1 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/23560.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/23560/head:pull/23560
PR: https://git.openjdk.org/jdk/pull/23560
More information about the nio-dev
mailing list