RFR: 8263898: (fs) Files.newOutputStream on the "NUL" special device throws FileSystemException: "nul: Incorrect function" (win) [v5]

Alan Bateman alanb at openjdk.java.net
Sun Mar 28 15:24:31 UTC 2021


On Fri, 26 Mar 2021 22:06:43 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> This request proposes to change the native method `WindowsNativeDispatcher.SetEndOfFile()` to succeed even if the Windows function `SetEndOfFile()` returns zero if `GetFileSizeEx()` called on the handle succeeds and reveals a file size of zero.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8263898: Fix accidentally reverted copyright year

test/jdk/java/nio/file/Files/NulDevice.java line 47:

> 45:             os.write(0x02);
> 46:             System.out.printf("Wrote a byte to %s%n", path);
> 47:             try (InputStream is = Files.newInputStream(path);) {

One other test that you could add here is to test that available() returns 0. I've no doubt there are many file operations that will behavior in surprising ways when using the special "NUL" device if the common operations work in unsurprising ways then it would help.

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

PR: https://git.openjdk.java.net/jdk/pull/3183


More information about the nio-dev mailing list