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

Alan Bateman alanb at openjdk.java.net
Thu Mar 25 07:37:40 UTC 2021


On Wed, 24 Mar 2021 23:45:16 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.

src/java.base/windows/native/libnio/fs/WindowsNativeDispatcher.c line 533:

> 531:         }
> 532:     }
> 533: }

The native methods are meant to map to one win32 call where possible. In this case, I think the workaround needs to be in WindowsChannelFile.open.

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

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


More information about the nio-dev mailing list