RFR: 8263898: (fs) Files.newOutputStream on the "NUL" special device throws FileSystemException: "nul: Incorrect function" (win) [v3]
Brian Burkhalter
bpb at openjdk.java.net
Fri Mar 26 16:10:27 UTC 2021
On Fri, 26 Mar 2021 07:03:51 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Remove whitespace
>
> test/jdk/java/nio/file/Files/NullDevice.java line 44:
>
>> 42: }
>> 43: }
>> 44: }
>
> The updated changes to the Windows file system provider looks good. Have you checked that WindowsNativeDispatcher.GetFileSizeEx returns the correct size for a non-zero length file? (asking about that because it won't be exercised by the any of the tests and we might want to use it in order places).
>
> The test name is "NullDevice" but it actually tests "nul" :-) so maybe it should be renamed. Files.newOutputStream is just one way to open the NUL device for writing. Would be good to also test opening it for wring without the TRUNCATE_EXISTING operation. I think we should do reading while we are there.
> You can use Path.of("nul") to avoid first creating a java.io.File and using toPath.
I don't have the length check in public code. I'll see how it is possible. I'll translate "null" into French and look at the reading and writing cases. I should have thought to use `Path.of()` especially given that I wrote it (JDK-8194746).
-------------
PR: https://git.openjdk.java.net/jdk/pull/3183
More information about the nio-dev
mailing list