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

Brian Burkhalter bpb at openjdk.java.net
Thu Mar 25 15:28:28 UTC 2021


On Thu, 25 Mar 2021 07:35:11 GMT, Alan Bateman <alanb 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.

I know. I tried at the Java level first and one cannot verify the size of the NUL device from Java.

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

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


More information about the nio-dev mailing list