RFR: 8349812: (fs) Files.newByteChannel with empty path name and CREATE_NEW throws unexpected exception [v4]
duke
duke at openjdk.org
Fri Feb 14 08:31:12 UTC 2025
On Thu, 13 Feb 2025 10:37:44 GMT, Maxim Kartashev <mkartashev at openjdk.org> wrote:
>> `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:
>
> Fixed the test to pass on Windows also
@mkartashev
Your change (at version fe5c10b9b6955e722cc8851b728c880dd8f89463) is now ready to be sponsored by a Committer.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/23560#issuecomment-2658584501
More information about the nio-dev
mailing list